drivers/tty/serial/mcf.c:586:25: sparse: sparse: unsigned value that used to be signed checked against zero?
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git cf-serial head: 13e7fc3bb9e0e6b9de008260d6925af530c79882 commit: 93cb854f633956fd1e5df8744a9e27695b2e8cd8 [1/4] serial: mcf: convert to use proper platform resources config: m68k-randconfig-r2310-20261118 (https://download.01.org/0day-ci/archive/20261118/[email protected]/config) compiler: m68k-linux-gcc (GCC) 8.5.0 sparse: v0.6.5-rc1-21-g84ec0658 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261118/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
drivers/tty/serial/mcf.c:513:30: sparse: sparse: Using plain integer as NULL pointer
>> drivers/tty/serial/mcf.c:586:25: sparse: sparse: unsigned value that used to be signed checked against zero?
drivers/tty/serial/mcf.c:585:37: sparse: signed value source
vim +586 drivers/tty/serial/mcf.c
501
502 static int __init mcf_console_setup(struct console *co, char *options)
503 {
504 struct uart_port *port;
505 int baud = CONFIG_SERIAL_MCF_BAUDRATE;
506 int bits = 8;
507 int parity = 'n';
508 int flow = 'n';
509
510 if ((co->index < 0) || (co->index >= MCF_MAXPORTS))
511 co->index = 0;
512 port = &mcf_ports[co->index].port;
> 513 if (port->membase == 0)
514 return -ENODEV;
515
516 if (options)
517 uart_parse_options(options, &baud, &parity, &bits, &flow);
518
519 return uart_set_options(port, co, baud, parity, bits, flow);
520 }
521
522 /****************************************************************************/
523
524 static struct uart_driver mcf_driver;
525
526 static struct console mcf_console = {
527 .name = "ttyS",
528 .write = mcf_console_write,
529 .device = uart_console_device,
530 .setup = mcf_console_setup,
531 .flags = CON_PRINTBUFFER,
532 .index = -1,
533 .data = &mcf_driver,
534 };
535
536 static int __init mcf_console_init(void)
537 {
538 register_console(&mcf_console);
539 return 0;
540 }
541
542 console_initcall(mcf_console_init);
543
544 #define MCF_CONSOLE &mcf_console
545
546 /****************************************************************************/
547 #else
548 /****************************************************************************/
549
550 #define MCF_CONSOLE NULL
551
552 /****************************************************************************/
553 #endif /* CONFIG_SERIAL_MCF_CONSOLE */
554 /****************************************************************************/
555
556 /*
557 * Define the mcf UART driver structure.
558 */
559 static struct uart_driver mcf_driver = {
560 .owner = THIS_MODULE,
561 .driver_name = "mcf",
562 .dev_name = "ttyS",
563 .major = TTY_MAJOR,
564 .minor = 64,
565 .nr = MCF_MAXPORTS,
566 .cons = MCF_CONSOLE,
567 };
568
569 /****************************************************************************/
570
571 static int mcf_probe(struct platform_device *pdev)
572 {
573 struct uart_port *port;
574 struct resource *res;
575
576 if (pdev->id >= MCF_MAXPORTS)
577 return -ENODEV;
578 port = &mcf_ports[pdev->id].port;
579
580 port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
581 if (IS_ERR(port->membase))
582 return PTR_ERR(port->membase);
583 port->mapbase = res->start;
584
585 port->irq = platform_get_irq(pdev, 0);
> 586 if (port->irq < 0) 587 return port->irq;
588
589 port->line = pdev->id;
590 port->type = PORT_MCF;
591 port->dev = &pdev->dev;
592 port->iotype = SERIAL_IO_MEM;
593 port->uartclk = MCF_BUSCLK;
594 port->ops = &mcf_uart_ops;
595 port->flags = UPF_BOOT_AUTOCONF;
596 port->rs485_config = mcf_config_rs485;
597 port->rs485_supported = mcf_rs485_supported;
598 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MCF_CONSOLE);
599
600 uart_add_one_port(&mcf_driver, port);
601 return 0;
602 }
603
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki