Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp190103pxx; Wed, 28 Oct 2020 02:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVSoIG79Vyzd4N8Q4/2lokr/tvIpZ6cmYyyWgZ4BIPSBgDUSGAmT+j5xI2ejBVOmAURlvq X-Received: by 2002:a17:906:31c6:: with SMTP id f6mr6677372ejf.164.1603876340148; Wed, 28 Oct 2020 02:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603876340; cv=none; d=google.com; s=arc-20160816; b=rTlArCf7Ae169B8wEu0VoZCg7N8Zv8pWWu81TtWFB/5cOQ/lDnxZEr/GzMZCa/3DPR LMkyC1NYOjTwcF1+xVtkJTxd7YopuTNa3BYWPiE1lgEWqNC8D4ZS5I9Aw4ha9oKqlKcT +k/RKeC2n2eew+dUu98PxaQ4DJSfV8K/8TUY5pQ8Q+famRKUhOgO84Ui4Qjpj+vijnRr LqEdnmbnkzYkF/9BXEiovzlaOTnzJLUA/nZ61molWLMNIyYIxg4p+SExmRZMTjpQn9ig 3Z2hi0SlzgjvEI0tZdemPkGkKKKIDxTHebWQT78YSu1QceGCUlpaBnUm8RikwToGAICF nvPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XhGK13ft+qFgSlPT17MI/h9QLbmQ9c22jrVv5VmFR3c=; b=0O2/M0N10XSQpru6hvpaVEJBuuvki/zN+jjJqXg8JEIjO/tje0z9QeqlIJReGXyQ9+ qkFQCFkMCqA5vmnHJ7eSzcoJD2Slteg3WarSdt46CyT30yKV58A27KZBMyfEhLuzdH3N Os1b4g7koeSSLpjkb8Va1Op1tAbj1g8uP8L6GhMMWqy2kltJJkAUcyQ+/z0jinIpaw/z u2uoVKpaKalg4DCBWxMPWVFX4RQREkS7ysb5lg7r5uyxyRJ828Le0QiMJuLtlPSyFV1y l57x69xvsGLYXhCCEqPECTLjfo4wPOb2yqnWyS9MxvNglmgn6rI6ClZhMEZVwDTXAsza FU3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cK3cgFAq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i19si2816688ejh.153.2020.10.28.02.11.57; Wed, 28 Oct 2020 02:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cK3cgFAq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2900892AbgJ0ORO (ORCPT + 99 others); Tue, 27 Oct 2020 10:17:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:34916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756472AbgJ0ONb (ORCPT ); Tue, 27 Oct 2020 10:13:31 -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 94CEC2072D; Tue, 27 Oct 2020 14:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808011; bh=aUaCq+ABJ015NZQWid6SoBHEGAphAYcU5/XDqh9DNUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cK3cgFAqevJ+rGVuJ3Vin62IftPiukx5aTdvX7KRwI0WnHBEszkxq+NRcD40blbtE wT2g/K2HKF+SUY8tsvpOm3Qx+Z6oH9r6wyJDZUXkiwAgqFDhZ/t7AnPIJSzNY9gl0+ 4hIglarkv01LYi2K0FxJCl8aI3sPKwIo2HuymRVg= 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 4.14 123/191] Input: twl4030_keypad - fix handling of platform_get_irq() error Date: Tue, 27 Oct 2020 14:49:38 +0100 Message-Id: <20201027134915.608587021@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@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 f9f98ef1d98e3..8677dbe0fd209 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -63,7 +63,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; @@ -389,10 +389,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