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: 10064013 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 49CFB601D3 for ; Fri, 17 Nov 2017 21:03:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C9982ADEE for ; Fri, 17 Nov 2017 21:03:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 317FC2ADF5; Fri, 17 Nov 2017 21:03:55 +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 C288C2ADEE for ; Fri, 17 Nov 2017 21:03:54 +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=DGzaJPcHSIJuOLZ0hD68eLcBTxTZi9/KmfNeWpqGHWE=; b=n/8xH5/6SoSJa+8kdf74oqGUWW SCpIx+UFdfzjcsWc/aLrDDzvWgCNt4mHiuPnVnOgBRzSW9h6cqQ1lesCDkqrEOppjjTNdmGMJUmF8 RIVPB+Uyw2yHSMH5sHeKBdTTJMdXAWAZm2dO7RNM2KV6YFrzzpTvhk1xBw8iXQaeIUPM+3KwDGz65 JCiQ0QhJMGwCYLRZ4oSoXXuqEObSIzBZ1t6fyd5RNZ9G4OK2/0OyC1MIALSGwzZHQmwEdJL8C5I1n Kn3CL0A8xExhLK8nPUnGVqQwOQuQoZtlg3WQBSiMC6wBvuf15laIchLC5olt5zsLVjrUX64i+NOX9 uLvA4l1w==; 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 1eFnnj-0002eS-2Y; Fri, 17 Nov 2017 21:03:51 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eFnjl-00074V-R1 for linux-arm-kernel@lists.infradead.org; Fri, 17 Nov 2017 20:59:48 +0000 Received: by mail-pg0-x243.google.com with SMTP id p9so2784944pgc.8 for ; 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=RNKp8qLYiB6o1OK6u6cXHmHcw5A3TRboWfPLEeMb789veQVUdd356RLf6wyq0y7mE8 9spGV2y8NK3kwMwiXcBoR363rjGRl85hQ5s09UCHDoPzKNtHIz4TbO8fIvfaol7QIo2f pl0k6mC3sZlUghphQga51Im1HBauIRCWhvmiGNroVw0Fud5uLKmbQVVhYKcj5C7G3CzU JfQgmp9AZ0PvOgb1JC+GdeVRiVCRmpT8Qmgvwdy6DX4SghAh7lVBy3x6Yk51nLXsvhEv Qcw/LaBzt440rkem5DIQyie1utOLDmovbRQ8US8jDHZwUpBu12cZNczlN3nejZYBYBNE FxJQ== X-Gm-Message-State: AJaThX5Vcj9/k5ymg4ntfBxJAh+hWxQB+97+fSoPJx4H2AldgaaA++fm IgkkZxi54gzxJWF7FRfq7Ek= 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171117_125945_955798_F3245090 X-CRM114-Status: GOOD ( 11.39 ) 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 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,