Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752334AbdLBT0k (ORCPT ); Sat, 2 Dec 2017 14:26:40 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:42680 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752233AbdLBT0h (ORCPT ); Sat, 2 Dec 2017 14:26:37 -0500 X-Google-Smtp-Source: AGs4zMZA6bi7hGE6AUlwQar4VzbVl8LF0NNpA/lUMmoDvjK4UehYFE03PmCze9HlQC4ovFa7hBIIZA== From: Arvind Yadav To: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, Vladislav.Zakharov@synopsys.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 01/10] net: bcmgenet: Fix platform_get_irq's error checking Date: Sun, 3 Dec 2017 00:56:13 +0530 Message-Id: <1512242782-7134-2-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 968 Lines: 24 The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav --- 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 24b4f4c..e2f1268 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3371,7 +3371,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 || priv->wol_irq <= 0) { dev_err(&pdev->dev, "can't find IRQs\n"); err = -EINVAL; goto err; -- 2.7.4