[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230531091159.8933-1-jiasheng@iscas.ac.cn>
Date: Wed, 31 May 2023 17:11:59 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: f.fainelli@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com,
bcm-kernel-feedback-list@...adcom.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] net: systemport: Add and correct check for platform_get_irq
Add the missing check for "priv->wol_irq".
Use "<" instead of "<=" to check the irqs since the platform_get_irq
returns non-zero IRQ number on success and negative error number on
failure, shown in `driver/base/platform.c`.
Fixes: 83e82f4c706b ("net: systemport: add Wake-on-LAN support")
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 38d0cdaf22a5..16c9c0be1a33 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2535,7 +2535,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
} else {
priv->wol_irq = platform_get_irq(pdev, 1);
}
- if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) {
+ if (priv->irq0 < 0 || (priv->irq1 < 0 && !priv->is_lite) || priv->wol_irq < 0) {
ret = -EINVAL;
goto err_free_netdev;
}
--
2.25.1
Powered by blists - more mailing lists