[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211221020030.117225-5-sashal@kernel.org>
Date: Mon, 20 Dec 2021 21:00:24 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Miaoqian Lin <linmq006@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>, opendmb@...il.com,
kuba@...nel.org, bcm-kernel-feedback-list@...adcom.com,
netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 4.19 05/11] net: bcmgenet: Fix NULL vs IS_ERR() checking
From: Miaoqian Lin <linmq006@...il.com>
[ Upstream commit ab8eb798ddabddb2944401bf31ead9671cb97d95 ]
The phy_attach() function does not return NULL. It returns error pointers.
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
Acked-by: Florian Fainelli <f.fainelli@...il.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
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 494601c39b847..0b6f6a3fd7347 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -549,9 +549,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.34.1
Powered by blists - more mailing lists