Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: phy: fix error check return value of phy_read()
@ 2022-04-19  1:44 cgel.zte
  2022-04-19 12:07 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: cgel.zte @ 2022-04-19  1:44 UTC (permalink / raw)
  To: f.fainelli, bcm-kernel-feedback-list, andrew
  Cc: hkallweit1, linux, davem, kuba, pabeni, netdev, linux-kernel,
	Lv Ruyi, Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

phy_read() returns a negative number if there's an error, but the
error-checking code in the bcm87xx driver's config_intr function
triggers if phy_read() returns non-zero.  Correct that.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/net/phy/bcm87xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 313563482690..e62b53718010 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -146,7 +146,7 @@ static int bcm87xx_config_intr(struct phy_device *phydev)
 
 	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
 		err = phy_read(phydev, BCM87XX_LASI_STATUS);
-		if (err)
+		if (err < 0)
 			return err;
 
 		reg |= 1;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-25 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-19  1:44 [PATCH] net: phy: fix error check return value of phy_read() cgel.zte
2022-04-19 12:07 ` Andrew Lunn
2022-04-25 15:55   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox