Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753093AbdLDRvW (ORCPT ); Mon, 4 Dec 2017 12:51:22 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34803 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752416AbdLDRsv (ORCPT ); Mon, 4 Dec 2017 12:48:51 -0500 X-Google-Smtp-Source: AGs4zMafzYYblOVydGMYU2pfhK+Gw2On31eX4qYiZpNg7hr/oQm/dpYy743ehzInvr5bHvv091tZNA== From: Arvind Yadav To: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 3/7 v2] can: xilinx: Fix platform_get_irq's error checking Date: Mon, 4 Dec 2017 23:18:19 +0530 Message-Id: <1512409703-20881-4-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512409703-20881-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1512409703-20881-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: 777 Lines: 27 platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- changes in v2: commit message was not correct. 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..1b859af 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