From patchwork Sat Nov 18 10:55:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10064777 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 E2A6460230 for ; Sat, 18 Nov 2017 11:04:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA5AC2A683 for ; Sat, 18 Nov 2017 11:04:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDC7E2A7A6; Sat, 18 Nov 2017 11:04:15 +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 6B1A02A683 for ; Sat, 18 Nov 2017 11:04:15 +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=Dnde+c15V0uqnrHF8Y+5ZIhqNoTufO293kjJ4us9P2o=; b=iohSuL5SoR8iPs+BU7zkcJ3opW ONRgilN0TJwbECoL1EE3ZqQxbmTdbhds1vgnmyE5/aha6pWPBwESe3TCFZQ3dhOBGLvbnsBPUNEL2 0nJ8F0o03DJvwTvY7/Q7W4J73weqXVeVX/b4zjoJyEfDraxBvvHD0Syv0i/jq+/pg10iENNKZaTgC 1Ea5S9wdJmM++lczhtYrHSRTdgBtays22og2CmSi+2sHTWeiaCSd9NXT50w7iXFQ1DyhibJqdjReO p0v1AKgw1FINUrptbWbyfpAQQoa44p2sQ5K1WabaQRINA57neju3FAI6oeGLi3VreuUFRjJzFwish /uM2PVgg==; 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 1eG0uz-0003Vu-Ji; Sat, 18 Nov 2017 11:04:13 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eG0nK-0005av-PH for linux-arm-kernel@lists.infradead.org; Sat, 18 Nov 2017 10:56:24 +0000 Received: by mail-pg0-x241.google.com with SMTP id u3so3840570pgn.7 for ; Sat, 18 Nov 2017 02:56:01 -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=B44O+Lbh679FkscUR2rgCQar37m3LHJplvS8yVB7rO4=; b=IukAnqNDAUQRQ4+BLth6xnnEiBJYPtW4cNPCZTOSCgbKJIRGTdK+7MYDJF7c2w1VXY G+cb7Voa5KHUnHejNug8oJHib9qy0BqapmeBUVOzpu0qYYCVKGXnte4zgk0CwZuKpbnw G0orjYxmLcEXFF0/8Iw3z9Co4PnxdTCNKGIOIx+N3AiBAvpC9Jbudj98Nkp3Q1C+kf4K vw62wgjSnRwThDHLUmbk2YZqAcnDklseGLaAfTooGlpnSDuSbVLnh2xQyZPMugB6M6AW RpAN5Cnmf3rSneNdtOwHv+8Z4iBQiRNbqfLDWl+5fEaa/sSpdLzQjLoT48ievWHZiJoi PfJw== 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=B44O+Lbh679FkscUR2rgCQar37m3LHJplvS8yVB7rO4=; b=l7LRBRHv2UiOHmXqBO3IIt6GrtAiwh6C160t51S5W4TVV+bnsLhOGhSNIYCbr4Bqop NcroiXVcQ8wJAsZvyWFXswfTDry1AbqXM2/QXv6ravED1b7Ig1VhFbif1Smp9XnbejKr +ZItgXUx9p5llMO15DTeKL+DBj+t6OBybX/V/tO3iyJcF0wJ7CXXJb3O0tKl+pb9dtxF 3Eqj+SsJLvKsU90vo2JSHWDB/ZzzdmAhzi41BL0dnUtjqBXTInyOm58LNek6fplE0Gpf 4qa1+VGd93nqj7oGiEpVPzxLlHX8BTLqKJSfJAM0bB/eDiDX2XuYsG+/jLpWNy3nMBYi 1SbA== X-Gm-Message-State: AJaThX6fsZKgrlHXoJu4/Sc1gtBQYkj9lHrM0FWVagDJl4TN463S/ypa +fYUqRhkAHD9mppwFrOp52Y= X-Google-Smtp-Source: AGs4zMblLyhRaElJIixCYwhZ6GhYA6Wsv+oIEzzI7iwxw/kN6NgGMNFn3IQCIIxNKD4GluEUQeFSFw== X-Received: by 10.84.168.193 with SMTP id f59mr8020184plb.22.1511002560593; Sat, 18 Nov 2017 02:56:00 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id g7sm12321513pfj.13.2017.11.18.02.55.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 02:55:59 -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 10/10 v2] Input: palmas-pwrbutton: Handle return value of platform_get_irq Date: Sat, 18 Nov 2017 16:25:17 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com> References: <76d6a73ba51e1a8a86d8d9a1d0bbbf7723d5153a.1510999334.git.arvind.yadav.cs@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171118_025619_491353_80EE1713 X-CRM114-Status: UNSURE ( 9.34 ) 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 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. drivers/input/misc/palmas-pwrbutton.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/input/misc/palmas-pwrbutton.c b/drivers/input/misc/palmas-pwrbutton.c index 1e1baed..f9b05cf 100644 --- a/drivers/input/misc/palmas-pwrbutton.c +++ b/drivers/input/misc/palmas-pwrbutton.c @@ -210,6 +210,11 @@ static int palmas_pwron_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&pwron->input_work, palmas_power_button_work); pwron->irq = platform_get_irq(pdev, 0); + if (pwron->irq <= 0) { + error = pwron->irq; + goto err_free_input; + } + error = request_threaded_irq(pwron->irq, NULL, pwron_irq, IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW |