netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: bcmasp: Do not check for 0 return after calling platform_get_irq()
@ 2023-09-01  7:04 Jinjie Ruan
  2023-09-01 14:02 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Jinjie Ruan @ 2023-09-01  7:04 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, netdev, Justin Chen, Florian Fainelli,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman
  Cc: ruanjinjie

It is not possible for platform_get_irq() to return 0. And it return
-EINVAL when the irq = 0 and -ENXIO when the irq can not be found. The
best practice is to return the err code from platform_get_irq().

Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index d63d321f3e7b..05b07da03398 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1231,8 +1231,8 @@ static int bcmasp_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	priv->irq = platform_get_irq(pdev, 0);
-	if (priv->irq <= 0)
-		return -EINVAL;
+	if (priv->irq < 0)
+		return priv->irq;
 
 	priv->clk = devm_clk_get_optional_enabled(dev, "sw_asp");
 	if (IS_ERR(priv->clk))
-- 
2.34.1


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

end of thread, other threads:[~2023-09-01 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01  7:04 [PATCH net-next] net: bcmasp: Do not check for 0 return after calling platform_get_irq() Jinjie Ruan
2023-09-01 14:02 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).