From patchwork Sat Nov 18 10:55:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10064773 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 D6FAA60230 for ; Sat, 18 Nov 2017 11:03:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C552A2A683 for ; Sat, 18 Nov 2017 11:03:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B81752A7A6; Sat, 18 Nov 2017 11:03:58 +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 445732A683 for ; Sat, 18 Nov 2017 11:03:57 +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=aJIHprJ8D+uNlX4xZglIKw437a2f1qVXKrp8vqBdW3I=; b=h1+CQSvL/x+bfvhEzb7fRHIUh+ 3eHrH8QdvXDI5aWkQA443mE53GyNlAcvVQrNafSE5MvpX3ESv1QsA4nBgwJA2Ec4qUhWdCRBK0Ye+ xR3VSi8Ai58LZA28MDQ5BMRGOwPPXAG6IwDSoH1bkFIW5PnV/MtMas6Qbwgs+ovr4Fa/hybT90rPe 96ohgt5SODuFN8sUXBj5D6HHRrHQPts9FNBvLo+EUqxK9gYBzfgAYKAYThoEGpbxN2AxHKKViA7zq vYbrw887oe3MbIzcOCdtTiboJf7aC4DX7Akl44KVP0CFIPegGWdDqVPazLy6G74kYjdrv1Bnmwyo1 Hyrb+wsQ==; 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 1eG0ui-0003E2-VW; Sat, 18 Nov 2017 11:03:56 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eG0nA-0005Vz-8e for linux-arm-kernel@lists.infradead.org; Sat, 18 Nov 2017 10:56:17 +0000 Received: by mail-pf0-x244.google.com with SMTP id a84so3837455pfl.0 for ; Sat, 18 Nov 2017 02:55:50 -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=Hog8Z63fV5rGelSdRwBiCu6XOIXMBYBhVz8IOZbSl8k=; b=fMQqtxUP2affoLBR/I2eR+qa1kO0/rXhJPnh0/OVZ5NhQWZqtHii8JYXhOWqMHiLny mtbs4UYTAEQtpKHAnzCxAKk2bgWzGG7KU05b7K2sQg4DXdntAzUpYZDfvfH3ZrErNkES aRHsgG2sxH1JY8K0MjTWIigN798bsXEmc3Xx+4jjTxa+qSkb0swJkECXIGKbkacEX8V3 rijH07L4JctCtQduXfDzamgnb10hF3tq9xfWwJvnCTVQXO6vE5aJ67PQIm2qr6H8Wy/z SM64BP9drDFu5xLG82X+8miOpSs1PaldfFWAk/HVA12Ez+uzKwCFM+xRxyUPekxbphTJ r1Rg== 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=Hog8Z63fV5rGelSdRwBiCu6XOIXMBYBhVz8IOZbSl8k=; b=ltZ3in2vAyQw9nSO0P/pN2MdPismJifNnHhojM53TSKjU444/IxM5ljam9q3Pz/5UK eig/KXLR+VDNyrDaLouHHLxjBzocm9agmM/mPZ0hV1cI4jHAQNSqa21R3PX9davqu6B/ mNrF42g5yv7jDeUdpoDIEX7LpeFZYn3B4cSKNLKUZSHcGcgJI8jVs5traGTy+MX3xrDJ /gheXBF9TiVCrkyVjuXJ6/RuI/tT9isqRTRR7I9zmI+7JnXD+XX1aderFBOFOFK4/YD3 gGaRFW2uYBbpRNNKagckh7gMAwhM388pfKa27k2aU8Qyrhn2UYxCa2ejMVvcI2zz7ui0 YKFQ== X-Gm-Message-State: AJaThX5h09PxtY4qPCdiFDsjQoqJg+x4y5+V3xPG4SYXrJRJfLEBUN+s yyf5L0TCDvgicxKtIq7Gm5I= X-Google-Smtp-Source: AGs4zMZYTzhZdDAh7w4rnJAjhPvL+lil5EJYuKGCLU0TSfnW+RPlB7EJA3L1SxkvAl47pEMFBNDsCA== X-Received: by 10.84.252.10 with SMTP id x10mr2123651pll.216.1511002550344; Sat, 18 Nov 2017 02:55:50 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id g7sm12321513pfj.13.2017.11.18.02.55.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 02:55:49 -0800 (PST) From: Arvind Yadav To: dmitry.torokhov@gmail.com, maxime.ripard@free-electrons.com, wens@csie.org, mcuos.com@gmail.com, linux@roeck-us.net, linux@armlinux.org.uk, lee.jones@linaro.org Subject: [PATCH 07/10 v3] Input: sun4i-ts: Handle return value of platform_get_irq Date: Sat, 18 Nov 2017 16:25:14 +0530 Message-Id: <184c9420c0824fe60df98db0922762e3abfb2e05.1510999558.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_025609_070315_80F84637 X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. 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, linux-input@vger.kernel.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 : ts->irq is unsigned. used int irq variable. changes in v3 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. drivers/input/touchscreen/sun4i-ts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index d2e14d9..315f26b 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -251,6 +251,7 @@ static int sun4i_ts_probe(struct platform_device *pdev) bool ts_attached; u32 tp_sensitive_adjust = 15; u32 filter_type = 1; + int irq; ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); if (!ts) @@ -314,7 +315,10 @@ static int sun4i_ts_probe(struct platform_device *pdev) if (IS_ERR(ts->base)) return PTR_ERR(ts->base); - ts->irq = platform_get_irq(pdev, 0); + irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return irq; + ts->irq = irq; error = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts); if (error) return error;