Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp186801pxx; Wed, 28 Oct 2020 02:05:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/QiVT75um5Nw0v8l07PjP2+OkBAMHqRNzCOx2mo3bPB6ABhdJfusauSIbFsU3vElls/TG X-Received: by 2002:a05:6402:1a56:: with SMTP id bf22mr6685075edb.216.1603875942756; Wed, 28 Oct 2020 02:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603875942; cv=none; d=google.com; s=arc-20160816; b=ES6EfrS66UWU+Dm90JYpaEYkFlVJQDZ03jHzPYyyIKi0fZQ7ZG8awZHwAX8KJPnYmw 8DOEkniBMNG46QOtthEXtqQWNkbgDWdgMOvQxyxmEvEKpIw1B69q4n576JCEOcZdVXkf 9fTatjwYOvbjQTI0aLArPRzwif74r9Ua0Ut9RA6snAzxl5EEh9UPXQeI0AQh7boJVwy2 xyXIjEMWqyPDUQ1tqP7gMb4ZXgBageZ3Vs9NC+bQwZ/dnr1kjOp8SimJF7+RcOfokKHt FpnpD/iflKGAXojWbA5e10OkxSBTmt3vldebp6D3wlGWze6NT0muDsYPEQMKwkcFZ3Pd 2zZw== 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=rkQjvwG9bk/YkaBdtw0I3OTbqc6UloMMgHzAVHx3ifM=; b=gHf6V/uM+FT344dC70B3H1mQP0xjQSj3dc56zzxF3dXXUcl0jZKJgrKZJbzhlC+Ys/ oT/gJh5dPdkWwnPNQl+oT2b+vEXgxToDUPuk6wjmt1TtBx7PFj3anFqaH4F3diwMqWGI YPYY+dERmBep20lsdRAlDhj5nXSucrGMr525FHSt4Qdq6Qm2r9hNF51wzFaQxwZr/L0O MW6yGTSEf5iHNHmIl9ENQht7B+WzRyNnbK5wYT5BQeQD6s8MacQELHAQe1ucg0/9q4pp +csRQIVTOWbFxsmZMbR1z/m8my7hc9+Ke3WFQoOCKVC6Oc99ex24L8gCOTNdA7IxdffM 0Q2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hwpF3tMj; 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 p19si2741759edu.169.2020.10.28.02.05.21; Wed, 28 Oct 2020 02:05:42 -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=hwpF3tMj; 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 S1756990AbgJ0OPg (ORCPT + 99 others); Tue, 27 Oct 2020 10:15:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:53792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754422AbgJ0OF0 (ORCPT ); Tue, 27 Oct 2020 10:05:26 -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 ED5672222C; Tue, 27 Oct 2020 14:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807525; bh=wDwf2i9uGR0rwnKUyq9gM6YhF7p9cbeUh3XtLO7HrWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hwpF3tMj0ZKtkhaYNUAx8ricwY7MOQ9U5K+FImATBhj4Ps7I17qQNNzEfm9xj1Ceg 6UPEg5erGYemD3N/rD49XkkEFn73clpj5+AyM0vP78QDW0n9kO1Qb9Gcg9EsH8JEom YEkZkibhB/hxIhLtQpzmhYoQI6eRM9sOpCivOkPk= 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.9 084/139] Input: twl4030_keypad - fix handling of platform_get_irq() error Date: Tue, 27 Oct 2020 14:49:38 +0100 Message-Id: <20201027134906.122228354@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 323a0fb575a44..d87e7cd11ecb6 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