Commit 3f88d7d1 authored by Divya Koppera's avatar Divya Koppera Committed by David S. Miller

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: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Signed-off-by: default avatarDivya Koppera <Divya.Koppera@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d50ede4f
...@@ -3008,10 +3008,6 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev) ...@@ -3008,10 +3008,6 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev)
{ {
struct lan8814_shared_priv *shared = phydev->shared->priv; 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*/ /* Initialise shared lock for clock*/
mutex_init(&shared->shared_lock); mutex_init(&shared->shared_lock);
...@@ -3031,12 +3027,16 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev) ...@@ -3031,12 +3027,16 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev)
shared->ptp_clock = ptp_clock_register(&shared->ptp_clock_info, shared->ptp_clock = ptp_clock_register(&shared->ptp_clock_info,
&phydev->mdio.dev); &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", phydev_err(phydev, "ptp_clock_register failed %lu\n",
PTR_ERR(shared->ptp_clock)); PTR_ERR(shared->ptp_clock));
return -EINVAL; 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"); phydev_dbg(phydev, "successfully registered ptp clock\n");
shared->phydev = phydev; shared->phydev = phydev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment