Received: by 10.223.164.202 with SMTP id h10csp2352959wrb; Sat, 18 Nov 2017 20:01:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMb7DfhC48eLQdQ2ypxzRC8do1CX6RFCyWoNWGc94GzpQ03kZep4DqPdKjX4ixptEeAg/EzO X-Received: by 10.98.71.25 with SMTP id u25mr7071024pfa.75.1511064105580; Sat, 18 Nov 2017 20:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511064105; cv=none; d=google.com; s=arc-20160816; b=M7hPCsuRG2GBE+W8lTSFMj3N8zCmzWYiq32YoPr6noBxgEHVHc2bsD+0qBCJkECOl2 mwgeAmPtIAyUb6//a7hbT7Pm23leYar4wVKlWTEjXs/tR87FHEp3oueVe/BYR6KNqSuo XqdDChaRPImfNLbWqdPjpVphoUq7DeW8ExsHQPK3Mvz09HYlcWJUsRcs8J2P7Eh5xKHo RHW9PZaamspLr5CMmrjLA0U0fzPIRvGNJuoKZ2q7Vzl8JoFaELoVhETOvKVhqR3DgMeW rw8hO3G5ROhJCKhSXDnxhuvjsMrrB5KgVYBL1sByJwoLVRr1fv7/3Fkxo8FQbz7WyVX4 AzVA== 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=Gy4Zi09ggh/9VtGtQOBn0kRT+VCRq6FfbUyrJ8uNEyU=; b=mLFNenSv16txxKlCLb3ix+QBFDEJS+okqaBnWdEiXXRmADMbtRfFfUgVMP+FCDhJoi X5VfgWOWRxp/3zCk4K0I1bj51y1omVWZLD0V1Xg+kHxcMHQzV9s83u+HwXZJEvyVmA6e hS/J5LkRzRJcWGbwsvILmfe94GejTxM8q+xtPx8o9Rt7VokUxpcfxEUAgGjCZKjM6TD6 VnL09JXvQouq/pskJFzIlLks1RIZChOgigwBujiUw/vzjW5juvoBU/0rMiwFXJJPWVgR wSzT8SKrLurcuRj8/FVrpQlo4kogcwPsyjpzOn9vQ7nY4ulmZzGIxi5jWvH+R6d9S7mE oQ1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j5nc1Jxa; 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 n9si5411719pgu.602.2017.11.18.20.01.32; Sat, 18 Nov 2017 20:01:45 -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=j5nc1Jxa; 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 S1946915AbdKRK4S (ORCPT + 93 others); Sat, 18 Nov 2017 05:56:18 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33732 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424029AbdKRKzg (ORCPT ); Sat, 18 Nov 2017 05:55:36 -0500 Received: by mail-pg0-f67.google.com with SMTP id s75so3854935pgs.0; Sat, 18 Nov 2017 02:55:36 -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=Gy4Zi09ggh/9VtGtQOBn0kRT+VCRq6FfbUyrJ8uNEyU=; b=j5nc1JxaDb5ApcoFJ/YcQ8a2UqBQBelhGade3F1/PgwnudAUw9Q5ydhv9jMCz/oZ/K KVRMbHNe85BIjUwR28/owrRkThuOK7jdcYrp3yk86xa1arZGf94jmNv3zppqayAk1xnM h/Fami9koitxdPjnPG67QgQuN7MDtZWbvmn2Jup+aeyWyKpmCG5QuWFomay1+rsp9JUS Poy/gqQwo/QQGkgB3NoQwcnd2UB7RasfGaJf+jUEaoAemD+YtmXvIiZkIFS51X0MNw8P eXke3jz+yWsm5FRTpxs2MpC7n85d+omXIscnJSH/VKEDJBGB9ZVwDjGgCEcq5bqqo0IK BkNQ== 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=Gy4Zi09ggh/9VtGtQOBn0kRT+VCRq6FfbUyrJ8uNEyU=; b=RUmJQazZ5LTsZzvT7hFxKQiRolqz7uDbEbvHlJb4iB1kqwXqcBEfCTOT2XQG52pLzk MI/qlxz9EEuW1KYdehoVlWQw4L+5Dr+JzdhZH2UECdbqiuN/id5qMJUcnvzidhLWmVIa HadMjDH+BADxkfX1CdffqV+36+NjqEERHh0tUTl04t5a+wUCrNZU/I2YuNUoEGRkqxOC uL0ItxGKVcqnrhUVanKO1Ud4YqTA0LCVsnPnXckSPsh2IJ8V3sxuL6nzfhJSr6Ay6ZKb 4FwL/WmlJx1wa4n25mdeWrXdIKQ5ILVGD+l7hQo0HNJx+TeAKpk9sr9nAPr94CGYX+nO y5zA== X-Gm-Message-State: AJaThX6cgV0rnswhFYMeIKmO7UHEb11dl8Sc2jS+2uzPbGA22w8v6Uao 2Yv0Oq6zneWW9ntQl8Bm67s= X-Received: by 10.159.208.67 with SMTP id w3mr7987822plz.175.1511002536314; Sat, 18 Nov 2017 02:55:36 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id g7sm12321513pfj.13.2017.11.18.02.55.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Nov 2017 02:55:35 -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 Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/10 v3] Input: twl4030_keypad: Fix platform_get_irq's error checking Date: Sat, 18 Nov 2017 16:25:10 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav --- changes in v2 : kp->irq is unsigned. use temporary int variable irq. changes in v3 : Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid. drivers/input/keyboard/twl4030_keypad.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index f9f98ef..d921238 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -341,6 +341,7 @@ static int twl4030_kp_probe(struct platform_device *pdev) struct input_dev *input; u8 reg; int error; + int irq; kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); if (!kp) @@ -388,11 +389,12 @@ static int twl4030_kp_probe(struct platform_device *pdev) return -EINVAL; } - kp->irq = platform_get_irq(pdev, 0); - if (!kp->irq) { + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { dev_err(&pdev->dev, "no keyboard irq assigned\n"); - return -EINVAL; + return irq; } + kp->irq = irq; error = matrix_keypad_build_keymap(keymap_data, NULL, TWL4030_MAX_ROWS, -- 2.7.4 From 1584165557873432859@xxx Wed Nov 15 20:33:25 +0000 2017 X-GM-THRID: 1584165557873432859 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread