net: bcmgenet: Fix return value check for fixed_phy_register()
authorRuan Jinjie <ruanjinjie@huawei.com>
Fri, 18 Aug 2023 05:12:21 +0000 (13:12 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 20 Aug 2023 09:58:28 +0000 (10:58 +0100)
The fixed_phy_register() function returns error pointers and never
returns NULL. Update the checks accordingly.

Fixes: b0ba512e25d7 ("net: bcmgenet: enable driver to work without a device tree")
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmmii.c

index 0092e46..cc3afb6 100644 (file)
@@ -617,7 +617,7 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
                };
 
                phydev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
-               if (!phydev || IS_ERR(phydev)) {
+               if (IS_ERR(phydev)) {
                        dev_err(kdev, "failed to register fixed PHY device\n");
                        return -ENODEV;
                }