From: kernel test robot <lkp@intel.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
H Hartley Sweeten <hartleys@visionengravers.com>,
Sebastian Reichel <sre@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: kbuild-all@lists.01.org
Subject: Re: [PATCH 3/4] Input: twl4030_keypad - Fix handling of platform_get_irq() error
Date: Fri, 28 Aug 2020 10:28:47 +0800 [thread overview]
Message-ID: <202008281053.dgfNG5qT%lkp@intel.com> (raw)
In-Reply-To: <20200827072420.22848-3-krzk@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 5042 bytes --]
Hi Krzysztof,
I love your patch! Perhaps something to improve:
[auto build test WARNING on input/next]
[also build test WARNING on sunxi/sunxi/for-next linus/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/Input-ep93xx_keypad-Fix-handling-of-platform_get_irq-error/20200827-152706
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: i386-randconfig-m021-20200828 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
smatch warnings:
drivers/input/keyboard/twl4030_keypad.c:379 twl4030_kp_probe() warn: unsigned 'kp->irq' is never less than zero.
# https://github.com/0day-ci/linux/commit/d83af6799bafdf8f1f84ddfc48876f621735963b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Krzysztof-Kozlowski/Input-ep93xx_keypad-Fix-handling-of-platform_get_irq-error/20200827-152706
git checkout d83af6799bafdf8f1f84ddfc48876f621735963b
vim +379 drivers/input/keyboard/twl4030_keypad.c
318
319 /*
320 * Registers keypad device with input subsystem
321 * and configures TWL4030 keypad registers
322 */
323 static int twl4030_kp_probe(struct platform_device *pdev)
324 {
325 struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
326 const struct matrix_keymap_data *keymap_data = NULL;
327 struct twl4030_keypad *kp;
328 struct input_dev *input;
329 u8 reg;
330 int error;
331
332 kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
333 if (!kp)
334 return -ENOMEM;
335
336 input = devm_input_allocate_device(&pdev->dev);
337 if (!input)
338 return -ENOMEM;
339
340 /* get the debug device */
341 kp->dbg_dev = &pdev->dev;
342 kp->input = input;
343
344 /* setup input device */
345 input->name = "TWL4030 Keypad";
346 input->phys = "twl4030_keypad/input0";
347
348 input->id.bustype = BUS_HOST;
349 input->id.vendor = 0x0001;
350 input->id.product = 0x0001;
351 input->id.version = 0x0003;
352
353 if (pdata) {
354 if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
355 dev_err(&pdev->dev, "Missing platform_data\n");
356 return -EINVAL;
357 }
358
359 kp->n_rows = pdata->rows;
360 kp->n_cols = pdata->cols;
361 kp->autorepeat = pdata->rep;
362 keymap_data = pdata->keymap_data;
363 } else {
364 error = matrix_keypad_parse_properties(&pdev->dev, &kp->n_rows,
365 &kp->n_cols);
366 if (error)
367 return error;
368
369 kp->autorepeat = true;
370 }
371
372 if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) {
373 dev_err(&pdev->dev,
374 "Invalid rows/cols amount specified in platform/devicetree data\n");
375 return -EINVAL;
376 }
377
378 kp->irq = platform_get_irq(pdev, 0);
> 379 if (kp->irq < 0)
380 return kp->irq;
381
382 error = matrix_keypad_build_keymap(keymap_data, NULL,
383 TWL4030_MAX_ROWS,
384 1 << TWL4030_ROW_SHIFT,
385 kp->keymap, input);
386 if (error) {
387 dev_err(kp->dbg_dev, "Failed to build keymap\n");
388 return error;
389 }
390
391 input_set_capability(input, EV_MSC, MSC_SCAN);
392 /* Enable auto repeat feature of Linux input subsystem */
393 if (kp->autorepeat)
394 __set_bit(EV_REP, input->evbit);
395
396 error = input_register_device(input);
397 if (error) {
398 dev_err(kp->dbg_dev,
399 "Unable to register twl4030 keypad device\n");
400 return error;
401 }
402
403 error = twl4030_kp_program(kp);
404 if (error)
405 return error;
406
407 /*
408 * This ISR will always execute in kernel thread context because of
409 * the need to access the TWL4030 over the I2C bus.
410 *
411 * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ...
412 */
413 error = devm_request_threaded_irq(&pdev->dev, kp->irq, NULL, do_kp_irq,
414 0, pdev->name, kp);
415 if (error) {
416 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d: %d\n",
417 kp->irq, error);
418 return error;
419 }
420
421 /* Enable KP and TO interrupts now. */
422 reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
423 if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
424 /* mask all events - we don't care about the result */
425 (void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
426 return -EIO;
427 }
428
429 return 0;
430 }
431
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31197 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-08-28 2:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-27 7:24 [PATCH 1/4] Input: ep93xx_keypad - Fix handling of platform_get_irq() error Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 2/4] Input: omap4-keypad " Krzysztof Kozlowski
2020-08-27 7:24 ` [PATCH 3/4] Input: twl4030_keypad " Krzysztof Kozlowski
2020-08-28 2:28 ` kernel test robot [this message]
2020-08-27 7:24 ` [PATCH 4/4] Input: sun4i-ps2 " Krzysztof Kozlowski
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=202008281053.dgfNG5qT%lkp@intel.com \
--to=lkp@intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hartleys@visionengravers.com \
--cc=kbuild-all@lists.01.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=sre@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).