From patchwork Sun Nov 19 04:26:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10065029 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 E9C696038F for ; Sun, 19 Nov 2017 04:27:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA177292B1 for ; Sun, 19 Nov 2017 04:27:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD842292F3; Sun, 19 Nov 2017 04:27:37 +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 597FA292B1 for ; Sun, 19 Nov 2017 04:27:36 +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=EeP0n8e65u54vgS1y+4wQbPUvvjeMUiNdIpRgKA8+cI=; b=QT7r8SDun6LD2e3dzUUimua8ui 4h/vp0ni3w4zg1cuFNgoz1vmQjtIcbXJz2iO+fLmjSmqoq2gLEGTuhL9+76kjLCzNGDPlTt3A9UpU +ZzPPjg1JEi3neiqiLaIGHze2+4eBhM7y3bWkwdN3lyn3YuKHATwrCgSdNGv+6JCnXpMXM6nt771o VnGGBd1KR6vefKQMllI9V+DI4WXcVUs2uK775lPWDUXNOLNO6qwIW4T86ngzooe+8s6jTiaDqlZ7G iCfVHKSHUvZDQubzgvxGx7qKHWaKWr1rAtC/mldDNqn5Dl2gkt7MI+VOjfrdGzydtS1pMOh2Iuqin +R9IUF7w==; 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 1eGHCh-0004rc-CJ; Sun, 19 Nov 2017 04:27:35 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eGHCO-0004b1-6E for linux-arm-kernel@lists.infradead.org; Sun, 19 Nov 2017 04:27:18 +0000 Received: by mail-pf0-x241.google.com with SMTP id j28so4838962pfk.8 for ; Sat, 18 Nov 2017 20:26:56 -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=rnThm3oPzqc8UqKO20Hu2Ng1f7HDQ5bJNYX3+g1f7qA=; b=fFt3MlyiMprqag6/GhhojKdsLRoHUITQaaI2HuM/uVjiCeFxO11lw/9BBK3/8kBcHE HO6DksxCbhPr/ZdypZ2LGg3wM8fC0zYNRxjL9RRkfZwsLZpnZqCMft0kWcPL3UfpI+lC OuZwr2gLrf42pQkHK5sDVjxJ4VSbWP1C3HkTc01LC07yZdeU7pcOaFYz9Q1lAj1nAw0r w6TiqvIiYzYBAFXkOwTSmjEALblBkddeWnGrJl7tQH5HZWVjOYyHua19oK9M/5OQtbym iZiD8Owe+MFDOBgegw7gd+AFt5gsr3Nk2fDEHB6HC6Pwv1CKPoz2MtyPerZcEQEwDRQK ZOOw== 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=rnThm3oPzqc8UqKO20Hu2Ng1f7HDQ5bJNYX3+g1f7qA=; b=jMjsnoSx2X4dnTz335htaIPjY0Ld8lWXpizp2bO7tWODBfqmo7tgYAMbxMTFBZQ5nP 2dl6o1pHvABu3yN7ItjUToQUmw6CPvYLSjWA45qvtrdqWnAWHAhdxLAjQbOJKkF5shxv oimc1gVk7T6Ss4j6D+SYhtFuhra5etnNzAj7WpFvEPUI1YW3azPpRK4QpL4vqNXVUdb8 ipp6ZSTuES5N1n7JK7JSQzJTwCl9fsXSdAhGZdsXrg2150u0m8gVJ/YhxA9gJOUurxVC ZF7/QMm67igyZn0s6El8HSTiAHaqAwxlAC2poLfh9/EyqSsSrfZhdQmeAQv6EUNynOaj 8VAA== X-Gm-Message-State: AJaThX7uIu0eIrEg3QpJJOiXXCAV8o1ShE1pA5VCA9/3EdDDmIXLMXv7 /Bnza3Qpio8uy68akS3MfP4= X-Google-Smtp-Source: AGs4zMYzXjhVPJVIj2Bw17ZJNSPmaaDNej03xEbVWk5DRTI9g/nPt2LkuyrDx00MzUXm1IxDaFn95g== X-Received: by 10.99.154.65 with SMTP id e1mr9483101pgo.18.1511065615628; Sat, 18 Nov 2017 20:26:55 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id e9sm11262795pgt.66.2017.11.18.20.26.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 20:26:55 -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 v3] mfd: sun4i-gpadc: Handle return value of platform_get_irq Date: Sun, 19 Nov 2017 09:56:33 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: <1bdd59d511e4acd23aea6af51d06b1cadf09a1b2.1511065331.git.arvind.yadav.cs@gmail.com> References: <1bdd59d511e4acd23aea6af51d06b1cadf09a1b2.1511065331.git.arvind.yadav.cs@gmail.com> In-Reply-To: <1bdd59d511e4acd23aea6af51d06b1cadf09a1b2.1511065331.git.arvind.yadav.cs@gmail.com> References: <1bdd59d511e4acd23aea6af51d06b1cadf09a1b2.1511065331.git.arvind.yadav.cs@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_202716_362014_D3CF3619 X-CRM114-Status: GOOD ( 10.75 ) 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. changes in v3 : return -EINVAL insted of irq. 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..79a39fe 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 -EINVAL; + ret = devm_regmap_add_irq_chip(&pdev->dev, dev->regmap, irq, IRQF_ONESHOT, 0, &sun4i_gpadc_regmap_irq_chip,