linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] Input: twl4030_keypad - Fix handling of platform_get_irq() error
Date: Fri, 28 Aug 2020 16:57:43 +0200	[thread overview]
Message-ID: <20200828145744.3636-3-krzk@kernel.org> (raw)
In-Reply-To: <20200828145744.3636-1-krzk@kernel.org>

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 <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v1:
1. Fix also casting return value to unsigned.
---
 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 af3a6824f1a4..77e0743a3cf8 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.17.1


  parent reply	other threads:[~2020-08-28 14:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 14:57 [PATCH v2 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-28 14:57 ` [PATCH v2 2/4] Input: omap4-keypad " Krzysztof Kozlowski
2020-09-16  0:53   ` Dmitry Torokhov
2020-09-16  6:06     ` Krzysztof Kozlowski
2020-09-16  6:25       ` Dmitry Torokhov
2020-08-28 14:57 ` Krzysztof Kozlowski [this message]
2020-08-28 14:57 ` [PATCH v2 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
2020-08-28 15:34   ` Chen-Yu Tsai
2020-09-16  1:01   ` Dmitry Torokhov
2020-09-16  6:08     ` Krzysztof Kozlowski
2020-09-11 15:31 ` [PATCH v2 1/4] Input: ep93xx_keypad " Krzysztof Kozlowski
2020-09-14  6:51 ` Dmitry Torokhov
2020-09-15 16:05   ` Krzysztof Kozlowski
2020-09-16  0:55     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200828145744.3636-3-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).