From: kernel test robot <lkp@intel.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [mnyman-xhci:dbc 5/5] drivers/usb/host/xhci-dbgtty.c:423 xhci_dbc_tty_register_device() warn: unsigned 'port->minor' is never less than zero.
Date: Thu, 20 Jan 2022 11:27:50 +0800 [thread overview]
Message-ID: <202201200955.C9pzrtCw-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git dbc
head: 595547d1cfa3f6c591ea084cc1f77cd45bd81213
commit: 595547d1cfa3f6c591ea084cc1f77cd45bd81213 [5/5] xhci: dbgtty: use IDR to support several dbc instances.
config: riscv-randconfig-m031-20220118 (https://download.01.org/0day-ci/archive/20220120/202201200955.C9pzrtCw-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
smatch warnings:
drivers/usb/host/xhci-dbgtty.c:423 xhci_dbc_tty_register_device() warn: unsigned 'port->minor' is never less than zero.
vim +423 drivers/usb/host/xhci-dbgtty.c
407
408 static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc)
409 {
410 int ret;
411 struct device *tty_dev;
412 struct dbc_port *port = dbc_to_port(dbc);
413
414 if (port->registered)
415 return -EBUSY;
416
417 xhci_dbc_tty_init_port(dbc, port);
418
419 mutex_lock(&dbc_tty_minors_lock);
420 port->minor = idr_alloc(&dbc_tty_minors, port, 0, 64, GFP_KERNEL);
421 mutex_unlock(&dbc_tty_minors_lock);
422
> 423 if (port->minor < 0) {
424 ret = port->minor;
425 goto err_idr;
426 }
427
428 ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL);
429 if (ret)
430 goto err_exit_port;
431
432 ret = xhci_dbc_alloc_requests(dbc, BULK_IN, &port->read_pool,
433 dbc_read_complete);
434 if (ret)
435 goto err_free_fifo;
436
437 ret = xhci_dbc_alloc_requests(dbc, BULK_OUT, &port->write_pool,
438 dbc_write_complete);
439 if (ret)
440 goto err_free_requests;
441
442 tty_dev = tty_port_register_device(&port->port,
443 dbc_tty_driver, port->minor, NULL);
444 if (IS_ERR(tty_dev)) {
445 ret = PTR_ERR(tty_dev);
446 goto err_free_requests;
447 }
448
449 port->registered = true;
450
451 return 0;
452
453 err_free_requests:
454 xhci_dbc_free_requests(&port->read_pool);
455 xhci_dbc_free_requests(&port->write_pool);
456 err_free_fifo:
457 kfifo_free(&port->write_fifo);
458 err_exit_port:
459 idr_remove(&dbc_tty_minors, port->minor);
460 err_idr:
461 xhci_dbc_tty_exit_port(port);
462
463 dev_err(dbc->dev, "can't register tty port, err %d\n", ret);
464
465 return ret;
466 }
467
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
reply other threads:[~2022-01-20 3:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202201200955.C9pzrtCw-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
/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
Powered by JetHome