net: phy: mscc: fix ptr_ret.cocci warnings
authorkernel test robot <lkp@intel.com>
Thu, 9 Jul 2020 16:06:18 +0000 (00:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Jul 2020 20:09:51 +0000 (13:09 -0700)
drivers/net/phy/mscc/mscc_ptp.c:1496:1-3: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: 7d272e63e097 ("net: phy: mscc: timestamping and PHC support")
CC: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mscc/mscc_ptp.c

index ef3441747348510677565ac0c9a78163840c6ee4..b97ee79f3cdfc08348351e713c16c691c9a87cd1 100644 (file)
@@ -1494,10 +1494,7 @@ static int __vsc8584_init_ptp(struct phy_device *phydev)
 
        vsc8531->ptp->ptp_clock = ptp_clock_register(&vsc8531->ptp->caps,
                                                     &phydev->mdio.dev);
-       if (IS_ERR(vsc8531->ptp->ptp_clock))
-               return PTR_ERR(vsc8531->ptp->ptp_clock);
-
-       return 0;
+       return PTR_ERR_OR_ZERO(vsc8531->ptp->ptp_clock);
 }
 
 void vsc8584_config_ts_intr(struct phy_device *phydev)