From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9FD4C388F9 for ; Tue, 27 Oct 2020 16:39:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6429621707 for ; Tue, 27 Oct 2020 16:39:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603816797; bh=MzlmVuAvenrDn5vJlUBmv5V5+3UhaYVG+lxeEYlJHW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xnn8e1VkHtxYMZlC6ntJXqEzxRar/Gc+4btM2I8+JgnJ9/mAJJBkR7Tk4Y22Lu/3+ KH5laHnXyi/552LIXWa+iGr1Yiy2MqX/gUMTaDDshjzrvXH4ck+p2HlKMgvkbAxR9k pPRei1euWt9Lx5uJUBaCJotTUmQEZgDAPP2q2Lv0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1811607AbgJ0Qj4 (ORCPT ); Tue, 27 Oct 2020 12:39:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801889AbgJ0Po6 (ORCPT ); Tue, 27 Oct 2020 11:44:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F070F22202; Tue, 27 Oct 2020 15:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813485; bh=MzlmVuAvenrDn5vJlUBmv5V5+3UhaYVG+lxeEYlJHW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loW6GObYvFKE2J7SBXK+UB6fem4xLgE6zzyUmdvg0xGU8FGxBi+PatESzeloJd8zr 2va4jOQRWrIVhQx4WpnC6lcTI+wgVh09ghjKSHSeraRmIqFL4G4R9xH5HymahD237e MA1/+iAm67drzJnj/JyMdqu7Uur8X16828w+4KLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Krzysztof Kozlowski , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.9 567/757] Input: twl4030_keypad - fix handling of platform_get_irq() error Date: Tue, 27 Oct 2020 14:53:37 +0100 Message-Id: <20201027135517.103645451@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski [ Upstream commit c277e1f0dc3c7d7b5b028e20dd414df241642036 ] platform_get_irq() returns -ERRNO on error. In such case casting to unsigned and comparing to 0 would pass the check. Fixes: 7abf38d6d13c ("Input: twl4030-keypad - add device tree support") Reported-by: kernel test robot Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20200828145744.3636-3-krzk@kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/keyboard/twl4030_keypad.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index af3a6824f1a4d..77e0743a3cf85 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -50,7 +50,7 @@ struct twl4030_keypad { bool autorepeat; unsigned int n_rows; unsigned int n_cols; - unsigned int irq; + int irq; struct device *dbg_dev; struct input_dev *input; @@ -376,10 +376,8 @@ static int twl4030_kp_probe(struct platform_device *pdev) } kp->irq = platform_get_irq(pdev, 0); - if (!kp->irq) { - dev_err(&pdev->dev, "no keyboard irq assigned\n"); - return -EINVAL; - } + if (kp->irq < 0) + return kp->irq; error = matrix_keypad_build_keymap(keymap_data, NULL, TWL4030_MAX_ROWS, -- 2.25.1