[bug report] tty: serial: Add Nuvoton ma35d1 serial driver support

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

 



Hello Jacky Huang,

Commit 930cbf92db01 ("tty: serial: Add Nuvoton ma35d1 serial driver
support") from Jun 19, 2023 (linux-next), leads to the following
Smatch static checker warning:

	drivers/tty/serial/ma35d1_serial.c:713 ma35d1serial_probe()
	error: we previously assumed 'pdev->dev.of_node' could be null (see line 691)

drivers/tty/serial/ma35d1_serial.c
    685 static int ma35d1serial_probe(struct platform_device *pdev)
    686 {
    687         struct resource *res_mem;
    688         struct uart_ma35d1_port *up;
    689         int ret = 0;
    690 
    691         if (pdev->dev.of_node) {
                    ^^^^^^^^^^^^^^^^^
Check for NULL

    692                 ret = of_alias_get_id(pdev->dev.of_node, "serial");
    693                 if (ret < 0) {
    694                         dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", ret);
    695                         return ret;
    696                 }
    697         }
    698         up = &ma35d1serial_ports[ret];
    699         up->port.line = ret;
    700         res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    701         if (!res_mem)
    702                 return -ENODEV;
    703 
    704         up->port.iobase = res_mem->start;
    705         up->port.membase = ioremap(up->port.iobase, MA35_UART_REG_SIZE);
    706         if (!up->port.membase)
    707                 return -ENOMEM;
    708 
    709         up->port.ops = &ma35d1serial_ops;
    710 
    711         spin_lock_init(&up->port.lock);
    712 
--> 713         up->clk = of_clk_get(pdev->dev.of_node, 0);
                                     ^^^^^^^^^^^^^^^^^
Unchecked dereference inside function

    714         if (IS_ERR(up->clk)) {
    715                 ret = PTR_ERR(up->clk);
    716                 dev_err(&pdev->dev, "failed to get core clk: %d\n", ret);
    717                 goto err_iounmap;

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