Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1628972

[PATCH 1/1] net: bcmgenet: fix incorrect return value checks

From Pan Bian <bianpan201602@163.com>
Newsgroups linux.kernel
Subject [PATCH 1/1] net: bcmgenet: fix incorrect return value checks
Date 2017-04-23 12:10 +0200
Message-ID <tzmCR-794-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Pan Bian <bianpan2016@163.com>

Function platform_get_irq() will return a negative value on errors.
However, in function bcmgenet_probe(), 0 is considered as a flag of
error. This patch fixes the bug by checking whether the return value of
platform_get_irq() is less than 0.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 365895e..0bccf2b 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3329,7 +3329,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	priv->irq0 = platform_get_irq(pdev, 0);
 	priv->irq1 = platform_get_irq(pdev, 1);
 	priv->wol_irq = platform_get_irq(pdev, 2);
-	if (!priv->irq0 || !priv->irq1) {
+	if (priv->irq0 < 0 || priv->irq1 < 0) {
 		dev_err(&pdev->dev, "can't find IRQs\n");
 		err = -EINVAL;
 		goto err;
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] net: bcmgenet: fix incorrect return value checks Pan Bian <bianpan201602@163.com> - 2017-04-23 12:10 +0200
  Re: [PATCH 1/1] net: bcmgenet: fix incorrect return value checks David Miller <davem@davemloft.net> - 2017-04-24 21:50 +0200
    Re: [PATCH 1/1] net: bcmgenet: fix incorrect return value checks Florian Fainelli <f.fainelli@gmail.com> - 2017-04-24 22:00 +0200

csiph-web