Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbdLDRtD (ORCPT ); Mon, 4 Dec 2017 12:49:03 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45571 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752598AbdLDRs5 (ORCPT ); Mon, 4 Dec 2017 12:48:57 -0500 X-Google-Smtp-Source: AGs4zMb2aOrbpcGixz4hDfyFJf+4C0yL0qT82NXiyLM3LpjI9H7KkX81zB8nxRqRRhq5o36Tw4zP4A== 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 5/7 v2] net: ethernet: natsemi: Fix platform_get_irq's error checking Date: Mon, 4 Dec 2017 23:18:21 +0530 Message-Id: <1512409703-20881-6-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: 793 Lines: 28 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/ethernet/natsemi/jazzsonic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c index d5b2888..22424e9 100644 --- a/drivers/net/ethernet/natsemi/jazzsonic.c +++ b/drivers/net/ethernet/natsemi/jazzsonic.c @@ -242,6 +242,11 @@ static int jazz_sonic_probe(struct platform_device *pdev) dev->base_addr = res->start; dev->irq = platform_get_irq(pdev, 0); + if (dev->irq <= 0) { + err = dev->irq ? dev->irq : -ENODEV; + goto out; + } + err = sonic_probe1(dev); if (err) goto out; -- 2.7.4