From patchwork Sat Nov 18 08:50:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10064581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1271C6023A for ; Sat, 18 Nov 2017 09:04:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D7D12A53A for ; Sat, 18 Nov 2017 09:04:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0267E2A5AE; Sat, 18 Nov 2017 09:04:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 849812A53A for ; Sat, 18 Nov 2017 09:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ADSV6TFnmCaZuICybYkeCFHJ8yVOSUQjUnvBwNAOLPs=; b=nNJHkuSKqrAm4YbV4Ob39M/QiE rlTK13uSoZ2sxyDJgPgIcvbC/6vubLCQJOEDZQSq3yOx/USyBXIEKpJqjIeG7XCtSAZtEp/SkPPzF /LT1ud6sn1W1gu/GZKiB3q1P8sn0VkJYFMdxhWLLo62/XneYn/FI8eMRadqi3P8oAyJvrwhG3Zi4H 0VwXBtky2rWZ1it99ZKd2G5Pwf4X1pDmUWg9lsbUECPd81FTlKmWRdjeCSPEzeVyXYRZg09P48MX1 MkXSSql5Iq6i3701Wncg3wNrKiKyw9tb1jWdMwy2QisGuijMJ3SeTTuPSLI091WIbdMv9A2aZkzwq 4B0SFs/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eFz2n-0001gD-7B; Sat, 18 Nov 2017 09:04:09 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFyqV-0002JK-Mn for linux-arm-kernel@lists.infradead.org; Sat, 18 Nov 2017 08:51:31 +0000 Received: by mail-pg0-x243.google.com with SMTP id c123so3692262pga.11 for ; Sat, 18 Nov 2017 00:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=b7Nptd2dY05ZnNJ6ISl4yfzpAIdkSeIv7W+nzRNT+/w=; b=WVY3C+1pfS+5DA9zYVK7TEKJ5xP9xIgKFd4BxwaHtv9aaxL//S9sXij09r/tMD/jee KPLJsXJhX03jAT7JKOq0oiwQ+Y8fV1aLWsfSQtaUvLnJvEE1XZKJWac+CkkglcQwgmG4 QfQ/VXGsV3oxkNfNs2t20/ND7d9FUUOtAWXhbZTDencvrOaBQJ4zV04a0X4+zMzzlP3t i8IbVJXpvYFbbWJtFp9jOItIFBF/vbXx+G0mKI5z2aUtV6JHWWvO51raGG0EKE0rQelV CBydSiZr2BCTM7p4H6c3f2DktD+DCJ9bMVZ64EaApQr2U5UoZeo8Y7wuUoWG9ZKYgc9h DGbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=b7Nptd2dY05ZnNJ6ISl4yfzpAIdkSeIv7W+nzRNT+/w=; b=PlXhYo3shUee3/9vWP70qZ1zuP+MPTNk8m2G1DLhYX6TXN1gDlqBqyGydZc9NIaTQU wmG0KIDFqbbvmh8cExPDmTSwyZJ4uKbBmp9sqg9sI0/wUOk9pdUB27Sg+e2Hyw+CTV24 8muaJI3N5mJxBRl4qFDyYU9IhrKKshQGwzslAW3f1ylNv1DzbINGnWmLLiFlI2HYNybc mpSYcUC2HayCSUknBiqP78c0jSUfgbYajIrdXYFC3RRswxvyl6/Xdn2MHafEQ8KfvsNY Od2bHPQGGWd9n9RxRWoEcs/lyKPkEBOGOIrGpTOPGf4R84IvVhw2mwiblIxReCGcQ1iC s+VQ== X-Gm-Message-State: AJaThX4Ki6NDVfceyXtX7orE7w3nuoEd0ke73vlHHEparSWCjrPEE644 0ZDD27POl4Hm6UALRKCamrU= X-Google-Smtp-Source: AGs4zMbl31oAYmciWSxQOriaxwvjPAsgafswBq7N+WsyzjcoN2tDr3RAIBy+g5S5klFb9mVA8rRncw== X-Received: by 10.101.82.193 with SMTP id z1mr7600811pgp.312.1510995067151; Sat, 18 Nov 2017 00:51:07 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id 3sm11847104pfo.17.2017.11.18.00.51.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 00:51:06 -0800 (PST) From: Arvind Yadav To: lee.jones@linaro.org, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk Subject: [PATCH 3/3 v2] mfd: sun4i-gpadc: Handle return value of platform_get_irq Date: Sat, 18 Nov 2017 14:20:49 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> References: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> In-Reply-To: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> References: <4f12b680d2f0d7554e6a1812f15037185a5a9a2a.1510994294.git.arvind.yadav.cs@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_005127_818482_7E7CE585 X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- changes in v2 : Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid. drivers/mfd/sun4i-gpadc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c index 9cfc881..1c89235 100644 --- a/drivers/mfd/sun4i-gpadc.c +++ b/drivers/mfd/sun4i-gpadc.c @@ -100,8 +100,8 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) struct resource *mem; const struct of_device_id *of_id; const struct mfd_cell *cells; - unsigned int irq, size; - int ret; + unsigned int size; + int ret, irq; of_id = of_match_node(sun4i_gpadc_of_match, pdev->dev.of_node); if (!of_id) @@ -148,6 +148,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) regmap_write(dev->regmap, SUN4I_GPADC_INT_FIFOC, 0); irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return irq; + ret = devm_regmap_add_irq_chip(&pdev->dev, dev->regmap, irq, IRQF_ONESHOT, 0, &sun4i_gpadc_regmap_irq_chip,