[bug report] tty/serial/8250: use mctrl_gpio helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Yegor Yefremov,

This is a semi-automatic email about new static checker warnings.

The patch 4a96895f74c9: "tty/serial/8250: use mctrl_gpio helpers" 
from Jun 20, 2019, leads to the following Smatch complaint:

    drivers/tty/serial/8250/8250_core.c:1026 serial8250_register_8250_port()
    error: we previously assumed 'uart->port.dev' could be null (see line 988)

drivers/tty/serial/8250/8250_core.c
   987	
   988			if (uart->port.dev)
                            ^^^^^^^^^^^^^^
There is an existing check for NULL here.

   989				uart_remove_one_port(&serial8250_reg, &uart->port);
   990	
   991			uart->port.iobase       = up->port.iobase;
   992			uart->port.membase      = up->port.membase;
   993			uart->port.irq          = up->port.irq;
   994			uart->port.irqflags     = up->port.irqflags;
   995			uart->port.uartclk      = up->port.uartclk;
   996			uart->port.fifosize     = up->port.fifosize;
   997			uart->port.regshift     = up->port.regshift;
   998			uart->port.iotype       = up->port.iotype;
   999			uart->port.flags        = up->port.flags | UPF_BOOT_AUTOCONF;
  1000			uart->bugs		= up->bugs;
  1001			uart->port.mapbase      = up->port.mapbase;
  1002			uart->port.mapsize      = up->port.mapsize;
  1003			uart->port.private_data = up->port.private_data;
  1004			uart->tx_loadsz		= up->tx_loadsz;
  1005			uart->capabilities	= up->capabilities;
  1006			uart->port.throttle	= up->port.throttle;
  1007			uart->port.unthrottle	= up->port.unthrottle;
  1008			uart->port.rs485_config	= up->port.rs485_config;
  1009			uart->port.rs485	= up->port.rs485;
  1010			uart->dma		= up->dma;
  1011	
  1012			/* Take tx_loadsz from fifosize if it wasn't set separately */
  1013			if (uart->port.fifosize && !uart->tx_loadsz)
  1014				uart->tx_loadsz = uart->port.fifosize;
  1015	
  1016			if (up->port.dev)
  1017				uart->port.dev = up->port.dev;
  1018	
  1019			if (up->port.flags & UPF_FIXED_TYPE)
  1020				uart->port.type = up->port.type;
  1021	
  1022			/*
  1023			 * Only call mctrl_gpio_init(), if the device has no ACPI
  1024			 * companion device
  1025			 */
  1026			if (!has_acpi_companion(uart->port.dev)) {
                                                ^^^^^^^^^^^^^^
This new code doesn't checked NULL.

  1027				gpios = mctrl_gpio_init(&uart->port, 0);
  1028				if (IS_ERR(gpios)) {

regards,
dan carpenter



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux