Received: by 10.223.164.202 with SMTP id h10csp2369097wrb; Sat, 18 Nov 2017 20:27:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMYLLyr05loLUqalk7xLhuBA+IvjGYmSjeIoZQ5SqBLa5P1GyKznMNzYyXJJPDMRZxCO/NGF X-Received: by 10.101.73.12 with SMTP id p12mr2716546pgs.37.1511065670966; Sat, 18 Nov 2017 20:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511065670; cv=none; d=google.com; s=arc-20160816; b=NLh6V3wEkqmQhzYIgmxJvbpzsTBEheKGdAzIv/OoJXw5nh+tt8rkU3WrHZbvM33iR5 SEe4d33KHWEYNdHiMX1dzyhS5n5fj77HEPOTaOC5ynHwirhrPoz6n6is+dlphwi50UOs nLbixLf6Ku1AGQcxDCb11Ny0XMnu6ff/hpyhnTxXkpxxhUNntC2SHnNldeWKOdJK3mrR KStZlAsuWTU7GG3HgAYO182SeO+fXLzZN/dlDoEeVA46wijcW2w/ZPNu0wlpzeb34W27 yNIIBa9TltzuTNQiKwI+lD8jh0+37m0AOrLV2FQ/ZgdpTYzX1oDE4DsQmdomPR/hQMIa M9XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=rnThm3oPzqc8UqKO20Hu2Ng1f7HDQ5bJNYX3+g1f7qA=; b=VKvZ6Qs2s3nI3QgQ9P3A6ChUzpjZO+Lnk4i/zLK5SXSZj/1OQBEoo2rwaaV3B7aDM0 oWrIr6EO1FpFfQZUdYfdNgmGjdAO5THlTiQsnNTllu4xt74QRoGOLTpAP4cNSrlbNqHO vcSzHKcKUP5FPswTYB+kneMZl9RJ3x+4RS3k8m3alAhMkBSMsO6w1NSaOHC7WuWfxIbN LpcOxgFxdnIbB0UQBq19n8AUiTkjnblSG0z42jYM93CxOhc1WmsKimQD7+Yqd5FWuxlx joRDrrmBvNGye7SPDKzxlwRbgkDx8KOx6qf1boriytkEhAgrtScCf/H+Xlr84rnNwmKH eRHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fFt3Mlyi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si5488221pgt.77.2017.11.18.20.27.39; Sat, 18 Nov 2017 20:27:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fFt3Mlyi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751061AbdKSE1B (ORCPT + 75 others); Sat, 18 Nov 2017 23:27:01 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43224 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdKSE04 (ORCPT ); Sat, 18 Nov 2017 23:26:56 -0500 Received: by mail-pf0-f193.google.com with SMTP id b6so4838912pff.10 for ; Sat, 18 Nov 2017 20:26:55 -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=BM1RaskQzXBYq9PIu3sjmUlIaH6OAiLvo7jDNaCobFbuCdYSKwIel/jQXRKA0OXoHu 4dYeF4dMBDTR2ptIfcFruOjbDsjXwzeF5LitmmiF8YiefUyb8VhxEtcurPfIhwajQ16M evzxI/wtCdYYkk4lK7R7liI+KmKjcwnCRzHDMe/fuZll5f6t8KuaUtid6PEMeTIHtn6A OLSNa4LlHewtBWJ12HXhX/d3CafwfuAtWRKrxyw7f9n8DdU2AdvU4yEVTPKi2I4GWtO+ Pf+Y/J5Y1IbnYH6LQkq/A4nVv4OP8TGmcvoRGvfFPrPaz/MsNbGX2/RmcxWM0jqPMkgn /KSg== X-Gm-Message-State: AJaThX6wt1tyi2hqtcP7imiN76+oIAaRZVyMhZ1DWKQFvdkqq+7LF2Wt RSv+mN3u2rXha0hs/NkSPGs= 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 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- 2.7.4 From 1584465046298683559@xxx Sun Nov 19 03:53:39 +0000 2017 X-GM-THRID: 1584465046298683559 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread