From patchwork Fri Nov 17 20:58:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10063945 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 633D06037E for ; Fri, 17 Nov 2017 20:59:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 573BC2949D for ; Fri, 17 Nov 2017 20:59:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B84A2ADF5; Fri, 17 Nov 2017 20:59:38 +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 3C0652949D for ; Fri, 17 Nov 2017 20:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761927AbdKQU7f (ORCPT ); Fri, 17 Nov 2017 15:59:35 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:39612 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761915AbdKQU70 (ORCPT ); Fri, 17 Nov 2017 15:59:26 -0500 Received: by mail-pg0-f68.google.com with SMTP id 70so2787458pgf.6; Fri, 17 Nov 2017 12:59:25 -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=Rrf3OinEN6dmv5dVFFz1+qXc7W2eShrqrD4HcbKTSAE=; b=scapeiJiQ6oy/ekZQCtXtaTce83OBXaiabXDO9xTOIxYmysRcYMpLDrkItlnAWw3qN VfADIlxPxPYgQAH8yo1w0do6vHKweX9nZyrDPk1wSwn4WzjeMLVV0WqZ8gWUe8WfEJD3 5zWlB7f1+MST+ZHY5agkRLMal3dQ0KqiXB970O3T6xJXq/GUySZsMMSW9hWKUJ530uUg SRos19IrugWEhnzGRAH3AACbqm9Z5lxuBNBg86YKvZfXced3royVk74fUTtTwxse+y1B PURoKt5w+2hMmywatg5dovacpj3Z3MlQuowwIi7nZFXJW+NmVaA8ufHbBM2gMjVqYBWB 6fJQ== 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=Rrf3OinEN6dmv5dVFFz1+qXc7W2eShrqrD4HcbKTSAE=; b=DNOcuvUllF8NAI/NttAu+XSUs8HZvmdvs7z/auAD1faEYHWfJOvxA3hQCtEXPTrjfN klxJb6xe8BGjcCcr4xXjcdf8cT6IryDWzK+F52hr6g55dTNxK13k0kt6eFHxDE9vUMwQ dFuTyQ0DR65SpQl/Eeypk3RDQvvglS2so7mLikn3ddJaOKGsL/mYPwy0pdLLAkCNaaBh UMNBqUmqxPQyiK0PtKo5l9IhlvpAnSIfeuWC2t4rnJUASF0DZqziwVfX6Pb6vMM7wfHJ iDmoVCWK5m+YefzISNp2LulAflPT3kZFqbG4HmFuJ8FhDmk9bGjldhetuT+QdKPWmd6m 37OA== X-Gm-Message-State: AJaThX6BNSO98K3ovFhqQx3SMTj0c37rXi92IfOBDoEgz6sX8HvVNTDf upqXIRcgezjl8lLdjPaY53CouB5P X-Google-Smtp-Source: AGs4zMZWSKzpznUvPlH7ysp8NdfyuPe6mePP8++cJ5BkSo+91HuIksWHx85WzpBnC8ECLveobM6Z2w== X-Received: by 10.84.240.74 with SMTP id h10mr6391109plt.109.1510952365039; Fri, 17 Nov 2017 12:59:25 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id f12sm7650857pga.7.2017.11.17.12.59.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Nov 2017 12:59:24 -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 2/3 v2] Input: twl4030_keypad: Fix platform_get_irq's error checking Date: Sat, 18 Nov 2017 02:28:49 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: 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 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. 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,