Re: [PATCH net-next] net: phy: micrel: Add support for PTP_PF_EXTTS for lan8841

From: Dan Carpenter
Date: Wed Mar 22 2023 - 04:08:49 EST


Hi Horatiu,

url: https://github.com/intel-lab-lkp/linux/commits/Horatiu-Vultur/net-phy-micrel-Add-support-for-PTP_PF_EXTTS-for-lan8841/20230321-195743
patch link: https://lore.kernel.org/r/20230321115541.4187912-1-horatiu.vultur%40microchip.com
patch subject: [PATCH net-next] net: phy: micrel: Add support for PTP_PF_EXTTS for lan8841
config: riscv-randconfig-m031-20230319 (https://download.01.org/0day-ci/archive/20230322/202303221128.KLPNcDLt-lkp@xxxxxxxxx/config)
compiler: riscv32-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Link: https://lore.kernel.org/r/202303221128.KLPNcDLt-lkp@xxxxxxxxx/

New smatch warnings:
drivers/net/phy/micrel.c:3480 lan8841_gpio_process_cap() warn: impossible condition '(tmp < 0) => (0-u16max < 0)'

Old smatch warnings:
drivers/net/phy/micrel.c:1683 ksz9x31_cable_test_get_status() error: uninitialized symbol 'ret'.

vim +3480 drivers/net/phy/micrel.c

25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3467 static void lan8841_gpio_process_cap(struct kszphy_ptp_priv *ptp_priv)
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3468 {
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3469 struct phy_device *phydev = ptp_priv->phydev;
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3470 struct ptp_clock_event ptp_event = {0};
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3471 s32 sec, nsec;
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3472 int pin, ret;
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3473 u16 tmp;
^^^^^^^

25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3474
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3475 pin = ptp_find_pin_unlocked(ptp_priv->ptp_clock, PTP_PF_EXTTS, 0);
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3476 if (pin == -1)
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3477 return;
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3478
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3479 tmp = phy_read_mmd(phydev, 2, LAN8841_PTP_GPIO_CAP_STS);
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 @3480 if (tmp < 0)
^^^^^^^
u16 can't be negative.

25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3481 return;
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3482
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3483 ret = phy_write_mmd(phydev, 2, LAN8841_PTP_GPIO_SEL,
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3484 LAN8841_PTP_GPIO_SEL_GPIO_SEL(pin));
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3485 if (ret)
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3486 return;
25cbf94843ee0b7 Horatiu Vultur 2023-03-21 3487

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests