From patchwork Fri Nov 17 19:15:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10063459 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 278116037E for ; Fri, 17 Nov 2017 19:18:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17BEF2ADA0 for ; Fri, 17 Nov 2017 19:18:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CA4E2ADB1; Fri, 17 Nov 2017 19:18:57 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B27B22ADA0 for ; Fri, 17 Nov 2017 19:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933727AbdKQTSm (ORCPT ); Fri, 17 Nov 2017 14:18:42 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35925 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935559AbdKQTQO (ORCPT ); Fri, 17 Nov 2017 14:16:14 -0500 Received: by mail-pg0-f65.google.com with SMTP id t10so2618796pgo.3; Fri, 17 Nov 2017 11:16:14 -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; bh=d3viQBAMeZkiwKRVS/CuL7SW/jIZPmEHRSwzUOSjE+w=; b=BgkVxXNFL4QFH6keWSoUlcwcGHNoTnoU+vk4nWO0n8gJHsoNTZH43rccsXZi6BnJbC qyG4+ErhxsA70eh0uxbIbCfxI6quTxZLkNEXsxyq6uj6wPkLcv66RQDjljPSllxdw6pP 4lWCx+7Oe/EImTYWAQ44A/BjztJ9top6aa/jBUDeDbzMgzpoOUacKQfPYDmfaqhMikGr Cnpz65zc+4QzqMcQekkEWmSg/jOJoJvaxcGyNjldTQNVlx9mNnKWY04xXABzKvufOWao fU9Dpkh5mDa5JgACaG9Vp83Y7ny6r302AZeaQ9Q6kPX5B4nKCv00FCWreCQCxYCXekjL 6ADQ== 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; bh=d3viQBAMeZkiwKRVS/CuL7SW/jIZPmEHRSwzUOSjE+w=; b=jE7we5f754V6i2K1kD+rWS4lNfCoLTWljpoWZIgPFb/sG8nEJ5J3QN3sjpYKR4RH3R zCQJW2IRkSw6Lz+YpQ1nuJFK8luXbXqhWb00nyeGV8RgQHN0NtVa9rUgkao0VT20fxcc srH0jQ6HrlpV6sprLl7CeO/AFHTx2yq0ktUSKRUon2681BbMRAeFsoYXpucz+WzNU+1X ehJrMpDT3/fjB0DN2gFrmhvwrtVfm6L6Z5rexWd7iHVmIgwbT10sYPAK1rHL/pFSU0ku hV63A2WtboDX+VsxC8wEuDoK+ca1khZ/WRSdaKmIYtbg2OwAIwO4t9ddCSbNWSS4aeKv kD0Q== X-Gm-Message-State: AJaThX78MsY2BNCojgW+5g8WBgoaJCHmAjQVSnL7N1MBQw48cwJmdNwf TElmtZvbMD32Byqw9f/B7Ik= X-Google-Smtp-Source: AGs4zMaqyNBz/T+P6UKCIqyKT3MfY4uDlPrGJP0eKufcTYj/xzmQCVN9vRhayQFyGCF1TOc0+nzLpQ== X-Received: by 10.98.109.134 with SMTP id i128mr3139518pfc.66.1510946173449; Fri, 17 Nov 2017 11:16:13 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id u188sm7807441pfb.188.2017.11.17.11.16.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Nov 2017 11:16:12 -0800 (PST) From: Arvind Yadav To: dmitry.torokhov@gmail.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@roeck-us.net, wsa@the-dreams.de, daniel.thompson@linaro.org, mcuos.com@gmail.com Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 05/10] Input: cpcap-pwrbutton: Handle return value of platform_get_irq Date: Sat, 18 Nov 2017 00:45:27 +0530 Message-Id: <1510946132-13554-6-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510946132-13554-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1510946132-13554-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.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 --- drivers/input/misc/cpcap-pwrbutton.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/misc/cpcap-pwrbutton.c b/drivers/input/misc/cpcap-pwrbutton.c index 0abef63..a4962e7 100644 --- a/drivers/input/misc/cpcap-pwrbutton.c +++ b/drivers/input/misc/cpcap-pwrbutton.c @@ -57,6 +57,9 @@ static int cpcap_power_button_probe(struct platform_device *pdev) int irq = platform_get_irq(pdev, 0); int err; + if (irq < 0) + return -ENODEV; + button = devm_kmalloc(&pdev->dev, sizeof(*button), GFP_KERNEL); if (!button) return -ENOMEM;