net: hns: Use IS_ERR_OR_NULL() helper function
authorHongbo Li <lihongbo22@huawei.com>
Wed, 28 Aug 2024 12:23:36 +0000 (20:23 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 29 Aug 2024 18:42:24 +0000 (11:42 -0700)
Use the IS_ERR_OR_NULL() helper instead of open-coding a
NULL and an error pointer checks to simplify the code and
improve readability.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20240828122336.3697176-1-lihongbo22@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c

index 616a2768e5048ab1d85ec7ea45471ab573ef7261..58baac7103b3805bb16ce46045b206bf6566497c 100644 (file)
@@ -734,7 +734,7 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb,
                return -ENODATA;
 
        phy = get_phy_device(mdio, addr, is_c45);
-       if (!phy || IS_ERR(phy))
+       if (IS_ERR_OR_NULL(phy))
                return -EIO;
 
        phy->irq = mdio->irq[addr];