[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211211140154.23613-1-linmq006@gmail.com>
Date: Sat, 11 Dec 2021 14:01:53 +0000
From: Miaoqian Lin <linmq006@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@...il.com, Doug Berger <opendmb@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
bcm-kernel-feedback-list@...adcom.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: bcmgenet: Fix NULL vs IS_ERR() checking
The phy_attach() function does not return NULL. It returns error pointers.
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 5f259641437a..c888ddee1fc4 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -589,9 +589,9 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
* Internal or external PHY with MDIO access
*/
phydev = phy_attach(priv->dev, phy_name, pd->phy_interface);
- if (!phydev) {
+ if (IS_ERR(phydev)) {
dev_err(kdev, "failed to register PHY device\n");
- return -ENODEV;
+ return PTR_ERR(phydev);
}
} else {
/*
--
2.17.1
Powered by blists - more mailing lists