diff options
author | Divya Koppera <Divya.Koppera@microchip.com> | 2023-01-06 13:59:05 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-01-09 07:21:42 +0000 |
commit | 3f88d7d1be42a84a4ae292f085c3886597a04137 (patch) | |
tree | de8bd811cb6b761fdd9d9164ec503de6b2b9d470 /drivers/net/phy/micrel.c | |
parent | d50ede4f53e19b63f785768ce62f9a5019c3a021 (diff) |
net: phy: micrel: Fix warn: passing zero to PTR_ERR
Handle the NULL pointer case
Fixes New smatch warnings:
drivers/net/phy/micrel.c:2613 lan8814_ptp_probe_once() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +2613 drivers/net/phy/micrel.c
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Divya Koppera <Divya.Koppera@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/micrel.c')
-rw-r--r-- | drivers/net/phy/micrel.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 6c41550310e7..d5b80c31ab91 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -3008,10 +3008,6 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev) { struct lan8814_shared_priv *shared = phydev->shared->priv; - if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK) || - !IS_ENABLED(CONFIG_NETWORK_PHY_TIMESTAMPING)) - return 0; - /* Initialise shared lock for clock*/ mutex_init(&shared->shared_lock); @@ -3031,12 +3027,16 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev) shared->ptp_clock = ptp_clock_register(&shared->ptp_clock_info, &phydev->mdio.dev); - if (IS_ERR_OR_NULL(shared->ptp_clock)) { + if (IS_ERR(shared->ptp_clock)) { phydev_err(phydev, "ptp_clock_register failed %lu\n", PTR_ERR(shared->ptp_clock)); return -EINVAL; } + /* Check if PHC support is missing at the configuration level */ + if (!shared->ptp_clock) + return 0; + phydev_dbg(phydev, "successfully registered ptp clock\n"); shared->phydev = phydev; |