[tty:tty-next 17/90] drivers/tty/serial/liteuart.c:328 liteuart_probe() warn: missing unwind goto?

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next
head:   05e2600cb0a4d73b0779cf29512819616252aeeb
commit: 5602cf99dcdcc0bf8f9a5979b7443fbe46686995 [17/90] serial: liteuart: add IRQ support for the RX path
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230121/202301210724.SCRcRjOR-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>

smatch warnings:
drivers/tty/serial/liteuart.c:328 liteuart_probe() warn: missing unwind goto?

vim +328 drivers/tty/serial/liteuart.c

1da81e5562fac8 Filip Kokosinski 2020-10-13  294  static int liteuart_probe(struct platform_device *pdev)
1da81e5562fac8 Filip Kokosinski 2020-10-13  295  {
1da81e5562fac8 Filip Kokosinski 2020-10-13  296  	struct liteuart_port *uart;
1da81e5562fac8 Filip Kokosinski 2020-10-13  297  	struct uart_port *port;
1da81e5562fac8 Filip Kokosinski 2020-10-13  298  	struct xa_limit limit;
1da81e5562fac8 Filip Kokosinski 2020-10-13  299  	int dev_id, ret;
1da81e5562fac8 Filip Kokosinski 2020-10-13  300  
1da81e5562fac8 Filip Kokosinski 2020-10-13  301  	/* look for aliases; auto-enumerate for free index if not found */
1da81e5562fac8 Filip Kokosinski 2020-10-13  302  	dev_id = of_alias_get_id(pdev->dev.of_node, "serial");
1da81e5562fac8 Filip Kokosinski 2020-10-13  303  	if (dev_id < 0)
1da81e5562fac8 Filip Kokosinski 2020-10-13  304  		limit = XA_LIMIT(0, CONFIG_SERIAL_LITEUART_MAX_PORTS);
1da81e5562fac8 Filip Kokosinski 2020-10-13  305  	else
1da81e5562fac8 Filip Kokosinski 2020-10-13  306  		limit = XA_LIMIT(dev_id, dev_id);
1da81e5562fac8 Filip Kokosinski 2020-10-13  307  
1da81e5562fac8 Filip Kokosinski 2020-10-13  308  	uart = devm_kzalloc(&pdev->dev, sizeof(struct liteuart_port), GFP_KERNEL);
1da81e5562fac8 Filip Kokosinski 2020-10-13  309  	if (!uart)
1da81e5562fac8 Filip Kokosinski 2020-10-13  310  		return -ENOMEM;
1da81e5562fac8 Filip Kokosinski 2020-10-13  311  
1da81e5562fac8 Filip Kokosinski 2020-10-13  312  	ret = xa_alloc(&liteuart_array, &dev_id, uart, limit, GFP_KERNEL);
1da81e5562fac8 Filip Kokosinski 2020-10-13  313  	if (ret)
1da81e5562fac8 Filip Kokosinski 2020-10-13  314  		return ret;
1da81e5562fac8 Filip Kokosinski 2020-10-13  315  
1da81e5562fac8 Filip Kokosinski 2020-10-13  316  	uart->id = dev_id;
1da81e5562fac8 Filip Kokosinski 2020-10-13  317  	port = &uart->port;
1da81e5562fac8 Filip Kokosinski 2020-10-13  318  
1da81e5562fac8 Filip Kokosinski 2020-10-13  319  	/* get membase */
1da81e5562fac8 Filip Kokosinski 2020-10-13  320  	port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
dd5e90b16cca8a Johan Hovold     2021-11-17  321  	if (IS_ERR(port->membase)) {
dd5e90b16cca8a Johan Hovold     2021-11-17  322  		ret = PTR_ERR(port->membase);
dd5e90b16cca8a Johan Hovold     2021-11-17  323  		goto err_erase_id;
dd5e90b16cca8a Johan Hovold     2021-11-17  324  	}
1da81e5562fac8 Filip Kokosinski 2020-10-13  325  
5602cf99dcdcc0 Gabriel Somlo    2022-11-23  326  	ret = platform_get_irq_optional(pdev, 0);
5602cf99dcdcc0 Gabriel Somlo    2022-11-23  327  	if (ret < 0 && ret != -ENXIO)
5602cf99dcdcc0 Gabriel Somlo    2022-11-23 @328  		return ret;

Needs to be "goto err_erase_id;"

5602cf99dcdcc0 Gabriel Somlo    2022-11-23  329  	if (ret > 0)
5602cf99dcdcc0 Gabriel Somlo    2022-11-23  330  		port->irq = ret;
5602cf99dcdcc0 Gabriel Somlo    2022-11-23  331  
1da81e5562fac8 Filip Kokosinski 2020-10-13  332  	/* values not from device tree */
1da81e5562fac8 Filip Kokosinski 2020-10-13  333  	port->dev = &pdev->dev;
1da81e5562fac8 Filip Kokosinski 2020-10-13  334  	port->iotype = UPIO_MEM;
1da81e5562fac8 Filip Kokosinski 2020-10-13  335  	port->flags = UPF_BOOT_AUTOCONF;
1da81e5562fac8 Filip Kokosinski 2020-10-13  336  	port->ops = &liteuart_ops;
1da81e5562fac8 Filip Kokosinski 2020-10-13  337  	port->fifosize = 16;
1da81e5562fac8 Filip Kokosinski 2020-10-13  338  	port->type = PORT_UNKNOWN;
1da81e5562fac8 Filip Kokosinski 2020-10-13  339  	port->line = dev_id;
1da81e5562fac8 Filip Kokosinski 2020-10-13  340  	spin_lock_init(&port->lock);
1da81e5562fac8 Filip Kokosinski 2020-10-13  341  
0f55f89d98c8b3 Ilia Sergachev   2021-11-15  342  	platform_set_drvdata(pdev, port);
0f55f89d98c8b3 Ilia Sergachev   2021-11-15  343  
dd5e90b16cca8a Johan Hovold     2021-11-17  344  	ret = uart_add_one_port(&liteuart_driver, &uart->port);
dd5e90b16cca8a Johan Hovold     2021-11-17  345  	if (ret)
dd5e90b16cca8a Johan Hovold     2021-11-17  346  		goto err_erase_id;
dd5e90b16cca8a Johan Hovold     2021-11-17  347  
dd5e90b16cca8a Johan Hovold     2021-11-17  348  	return 0;
dd5e90b16cca8a Johan Hovold     2021-11-17  349  
dd5e90b16cca8a Johan Hovold     2021-11-17  350  err_erase_id:
dd5e90b16cca8a Johan Hovold     2021-11-17  351  	xa_erase(&liteuart_array, uart->id);
dd5e90b16cca8a Johan Hovold     2021-11-17  352  
dd5e90b16cca8a Johan Hovold     2021-11-17  353  	return ret;
1da81e5562fac8 Filip Kokosinski 2020-10-13  354  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests




[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