Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752462AbdLBT0w (ORCPT ); Sat, 2 Dec 2017 14:26:52 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35464 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752402AbdLBT0r (ORCPT ); Sat, 2 Dec 2017 14:26:47 -0500 X-Google-Smtp-Source: AGs4zMaYE9dwhEp4pHPsXQSKYHvtswSOb0jMwZ8rxAqEc5n8tqql0OWsLrm/mB+YHUQ5i/Vr+8fX6w== 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 04/10] can: xilinx: Handle return value of platform_get_irq Date: Sun, 3 Dec 2017 00:56:16 +0530 Message-Id: <1512242782-7134-5-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: 716 Lines: 24 platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/net/can/xilinx_can.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 89aec07..e36e2a2 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -1111,6 +1111,10 @@ static int xcan_probe(struct platform_device *pdev) /* Get IRQ for the device */ ndev->irq = platform_get_irq(pdev, 0); + if (ndev->irq <= 0) { + ret = ndev->irq ? ndev->irq : -ENODEV; + goto err_free; + } ndev->flags |= IFF_ECHO; /* We support local echo */ platform_set_drvdata(pdev, ndev); -- 2.7.4