Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752520AbdLBT04 (ORCPT ); Sat, 2 Dec 2017 14:26:56 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33492 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbdLBT0x (ORCPT ); Sat, 2 Dec 2017 14:26:53 -0500 X-Google-Smtp-Source: AGs4zMbixsckT4zmZcU30W0Y+A7ZdPnCM5SEga3wc+izTg8t81HfYttLEWVo24YzNh+Ynh2Sx/41ug== 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 06/10] net: ethernet: natsemi: Handle return value of platform_get_irq Date: Sun, 3 Dec 2017 00:56:18 +0530 Message-Id: <1512242782-7134-7-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: 732 Lines: 25 platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- 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..3cf0856 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