[gerg-m68knommu:dt 1/14] drivers/tty/serial/mcf.c:586 mcf_probe() warn: unsigned 'port->irq' is never less than zero.

kernel test robot
2025-06-11T07:39:15Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git dt
head: a227d3c7914f7e7059bba92fc8a99e4be11b0abf
commit: b2003b0b32e6f27f160e4ace887dcab10e266999 [1/14] serial: mcf: convert to use proper platform resources
config: m68k-randconfig-r071-20250611 (https://download.01.org/0day-ci/archive/20250611/202506111514.txSKxqO9-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 8.5.0

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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506111514.txSKxqO9-lkp@intel.com/

New smatch warnings:
drivers/tty/serial/mcf.c:586 mcf_probe() warn: unsigned 'port->irq' is never less than zero.

Old smatch warnings:
arch/m68k/include/asm/io_no.h:50 __cf_internalio() warn: always true condition '(addr <= 3758096384 + 536870912 - 1) => (0-u32max <= u32max)'

vim +586 drivers/tty/serial/mcf.c

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

--
0-DAY CI Kernel Test Service