Re: [PATCH] tty: serial: mvebu-uart: Remove unused variable 'ret'

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

 



Hi Pujin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v5.9-rc8]
[cannot apply to tty/tty-testing next-20201002]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Pujin-Shi/tty-serial-mvebu-uart-Remove-unused-variable-ret/20200930-161555
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: powerpc-randconfig-r035-20201005 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 39fc4a0b0af69772ee360b5f729b1ec453217793)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/c2857134bbb1c0f004f4d026e62a2b90aa2015a0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Pujin-Shi/tty-serial-mvebu-uart-Remove-unused-variable-ret/20200930-161555
        git checkout c2857134bbb1c0f004f4d026e62a2b90aa2015a0
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

>> drivers/tty/serial/mvebu-uart.c:915:2: error: use of undeclared identifier 'ret'; did you mean 'reg'?
           ret = uart_add_one_port(&mvebu_uart_driver, port);
           ^~~
           reg
   drivers/tty/serial/mvebu-uart.c:801:19: note: 'reg' declared here
           struct resource *reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
                            ^
>> drivers/tty/serial/mvebu-uart.c:915:6: warning: incompatible integer to pointer conversion assigning to 'struct resource *' from 'int' [-Wint-conversion]
           ret = uart_add_one_port(&mvebu_uart_driver, port);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/mvebu-uart.c:916:6: error: use of undeclared identifier 'ret'; did you mean 'reg'?
           if (ret)
               ^~~
               reg
   drivers/tty/serial/mvebu-uart.c:801:19: note: 'reg' declared here
           struct resource *reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
                            ^
   drivers/tty/serial/mvebu-uart.c:917:10: error: use of undeclared identifier 'ret'; did you mean 'reg'?
                   return ret;
                          ^~~
                          reg
   drivers/tty/serial/mvebu-uart.c:801:19: note: 'reg' declared here
           struct resource *reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
                            ^
>> drivers/tty/serial/mvebu-uart.c:917:10: warning: incompatible pointer to integer conversion returning 'struct resource *' from a function with result type 'int' [-Wint-conversion]
                   return ret;
                          ^~~
   2 warnings and 3 errors generated.

vim +915 drivers/tty/serial/mvebu-uart.c

94228f9561bb6c Allen Yan     2017-10-13  798  
30530791a7a032 Wilson Ding   2016-02-16  799  static int mvebu_uart_probe(struct platform_device *pdev)
30530791a7a032 Wilson Ding   2016-02-16  800  {
30530791a7a032 Wilson Ding   2016-02-16  801  	struct resource *reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5218d76958644a Miquel Raynal 2017-10-13  802  	const struct of_device_id *match = of_match_device(mvebu_uart_of_match,
5218d76958644a Miquel Raynal 2017-10-13  803  							   &pdev->dev);
30530791a7a032 Wilson Ding   2016-02-16  804  	struct uart_port *port;
5218d76958644a Miquel Raynal 2017-10-13  805  	struct mvebu_uart *mvuart;
c2857134bbb1c0 Pujin Shi     2020-09-30  806  	int id, irq;
30530791a7a032 Wilson Ding   2016-02-16  807  
95f787685a224e Miquel Raynal 2017-10-13  808  	if (!reg) {
95f787685a224e Miquel Raynal 2017-10-13  809  		dev_err(&pdev->dev, "no registers defined\n");
30530791a7a032 Wilson Ding   2016-02-16  810  		return -EINVAL;
30530791a7a032 Wilson Ding   2016-02-16  811  	}
30530791a7a032 Wilson Ding   2016-02-16  812  
32f47179833b63 Aditya Pakki  2019-03-18  813  	if (!match)
32f47179833b63 Aditya Pakki  2019-03-18  814  		return -ENODEV;
32f47179833b63 Aditya Pakki  2019-03-18  815  
94228f9561bb6c Allen Yan     2017-10-13  816  	/* Assume that all UART ports have a DT alias or none has */
94228f9561bb6c Allen Yan     2017-10-13  817  	id = of_alias_get_id(pdev->dev.of_node, "serial");
94228f9561bb6c Allen Yan     2017-10-13  818  	if (!pdev->dev.of_node || id < 0)
94228f9561bb6c Allen Yan     2017-10-13  819  		pdev->id = uart_num_counter++;
94228f9561bb6c Allen Yan     2017-10-13  820  	else
94228f9561bb6c Allen Yan     2017-10-13  821  		pdev->id = id;
94228f9561bb6c Allen Yan     2017-10-13  822  
94228f9561bb6c Allen Yan     2017-10-13  823  	if (pdev->id >= MVEBU_NR_UARTS) {
94228f9561bb6c Allen Yan     2017-10-13  824  		dev_err(&pdev->dev, "cannot have more than %d UART ports\n",
94228f9561bb6c Allen Yan     2017-10-13  825  			MVEBU_NR_UARTS);
94228f9561bb6c Allen Yan     2017-10-13  826  		return -EINVAL;
94228f9561bb6c Allen Yan     2017-10-13  827  	}
94228f9561bb6c Allen Yan     2017-10-13  828  
94228f9561bb6c Allen Yan     2017-10-13  829  	port = &mvebu_uart_ports[pdev->id];
30530791a7a032 Wilson Ding   2016-02-16  830  
30530791a7a032 Wilson Ding   2016-02-16  831  	spin_lock_init(&port->lock);
30530791a7a032 Wilson Ding   2016-02-16  832  
30530791a7a032 Wilson Ding   2016-02-16  833  	port->dev        = &pdev->dev;
30530791a7a032 Wilson Ding   2016-02-16  834  	port->type       = PORT_MVEBU;
30530791a7a032 Wilson Ding   2016-02-16  835  	port->ops        = &mvebu_uart_ops;
30530791a7a032 Wilson Ding   2016-02-16  836  	port->regshift   = 0;
30530791a7a032 Wilson Ding   2016-02-16  837  
30530791a7a032 Wilson Ding   2016-02-16  838  	port->fifosize   = 32;
30530791a7a032 Wilson Ding   2016-02-16  839  	port->iotype     = UPIO_MEM32;
30530791a7a032 Wilson Ding   2016-02-16  840  	port->flags      = UPF_FIXED_PORT;
94228f9561bb6c Allen Yan     2017-10-13  841  	port->line       = pdev->id;
30530791a7a032 Wilson Ding   2016-02-16  842  
95f787685a224e Miquel Raynal 2017-10-13  843  	/*
95f787685a224e Miquel Raynal 2017-10-13  844  	 * IRQ number is not stored in this structure because we may have two of
95f787685a224e Miquel Raynal 2017-10-13  845  	 * them per port (RX and TX). Instead, use the driver UART structure
95f787685a224e Miquel Raynal 2017-10-13  846  	 * array so called ->irq[].
95f787685a224e Miquel Raynal 2017-10-13  847  	 */
95f787685a224e Miquel Raynal 2017-10-13  848  	port->irq        = 0;
30530791a7a032 Wilson Ding   2016-02-16  849  	port->irqflags   = 0;
30530791a7a032 Wilson Ding   2016-02-16  850  	port->mapbase    = reg->start;
30530791a7a032 Wilson Ding   2016-02-16  851  
30530791a7a032 Wilson Ding   2016-02-16  852  	port->membase = devm_ioremap_resource(&pdev->dev, reg);
30530791a7a032 Wilson Ding   2016-02-16  853  	if (IS_ERR(port->membase))
4a3e208474204e tangbin       2020-03-05  854  		return PTR_ERR(port->membase);
30530791a7a032 Wilson Ding   2016-02-16  855  
5218d76958644a Miquel Raynal 2017-10-13  856  	mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart),
30530791a7a032 Wilson Ding   2016-02-16  857  			      GFP_KERNEL);
5218d76958644a Miquel Raynal 2017-10-13  858  	if (!mvuart)
30530791a7a032 Wilson Ding   2016-02-16  859  		return -ENOMEM;
30530791a7a032 Wilson Ding   2016-02-16  860  
68a0db1d7da20f Allen Yan     2017-10-13  861  	/* Get controller data depending on the compatible string */
5218d76958644a Miquel Raynal 2017-10-13  862  	mvuart->data = (struct mvebu_uart_driver_data *)match->data;
5218d76958644a Miquel Raynal 2017-10-13  863  	mvuart->port = port;
30530791a7a032 Wilson Ding   2016-02-16  864  
5218d76958644a Miquel Raynal 2017-10-13  865  	port->private_data = mvuart;
5218d76958644a Miquel Raynal 2017-10-13  866  	platform_set_drvdata(pdev, mvuart);
30530791a7a032 Wilson Ding   2016-02-16  867  
68a0db1d7da20f Allen Yan     2017-10-13  868  	/* Get fixed clock frequency */
68a0db1d7da20f Allen Yan     2017-10-13  869  	mvuart->clk = devm_clk_get(&pdev->dev, NULL);
68a0db1d7da20f Allen Yan     2017-10-13  870  	if (IS_ERR(mvuart->clk)) {
68a0db1d7da20f Allen Yan     2017-10-13  871  		if (PTR_ERR(mvuart->clk) == -EPROBE_DEFER)
68a0db1d7da20f Allen Yan     2017-10-13  872  			return PTR_ERR(mvuart->clk);
68a0db1d7da20f Allen Yan     2017-10-13  873  
68a0db1d7da20f Allen Yan     2017-10-13  874  		if (IS_EXTENDED(port)) {
68a0db1d7da20f Allen Yan     2017-10-13  875  			dev_err(&pdev->dev, "unable to get UART clock\n");
68a0db1d7da20f Allen Yan     2017-10-13  876  			return PTR_ERR(mvuart->clk);
68a0db1d7da20f Allen Yan     2017-10-13  877  		}
68a0db1d7da20f Allen Yan     2017-10-13  878  	} else {
68a0db1d7da20f Allen Yan     2017-10-13  879  		if (!clk_prepare_enable(mvuart->clk))
68a0db1d7da20f Allen Yan     2017-10-13  880  			port->uartclk = clk_get_rate(mvuart->clk);
68a0db1d7da20f Allen Yan     2017-10-13  881  	}
68a0db1d7da20f Allen Yan     2017-10-13  882  
95f787685a224e Miquel Raynal 2017-10-13  883  	/* Manage interrupts */
95f787685a224e Miquel Raynal 2017-10-13  884  	if (platform_irq_count(pdev) == 1) {
95f787685a224e Miquel Raynal 2017-10-13  885  		/* Old bindings: no name on the single unamed UART0 IRQ */
95f787685a224e Miquel Raynal 2017-10-13  886  		irq = platform_get_irq(pdev, 0);
1df217868178bd Stephen Boyd  2019-07-30  887  		if (irq < 0)
95f787685a224e Miquel Raynal 2017-10-13  888  			return irq;
95f787685a224e Miquel Raynal 2017-10-13  889  
95f787685a224e Miquel Raynal 2017-10-13  890  		mvuart->irq[UART_IRQ_SUM] = irq;
95f787685a224e Miquel Raynal 2017-10-13  891  	} else {
95f787685a224e Miquel Raynal 2017-10-13  892  		/*
95f787685a224e Miquel Raynal 2017-10-13  893  		 * New bindings: named interrupts (RX, TX) for both UARTS,
95f787685a224e Miquel Raynal 2017-10-13  894  		 * only make use of uart-rx and uart-tx interrupts, do not use
95f787685a224e Miquel Raynal 2017-10-13  895  		 * uart-sum of UART0 port.
95f787685a224e Miquel Raynal 2017-10-13  896  		 */
95f787685a224e Miquel Raynal 2017-10-13  897  		irq = platform_get_irq_byname(pdev, "uart-rx");
1df217868178bd Stephen Boyd  2019-07-30  898  		if (irq < 0)
95f787685a224e Miquel Raynal 2017-10-13  899  			return irq;
95f787685a224e Miquel Raynal 2017-10-13  900  
95f787685a224e Miquel Raynal 2017-10-13  901  		mvuart->irq[UART_RX_IRQ] = irq;
95f787685a224e Miquel Raynal 2017-10-13  902  
95f787685a224e Miquel Raynal 2017-10-13  903  		irq = platform_get_irq_byname(pdev, "uart-tx");
1df217868178bd Stephen Boyd  2019-07-30  904  		if (irq < 0)
95f787685a224e Miquel Raynal 2017-10-13  905  			return irq;
95f787685a224e Miquel Raynal 2017-10-13  906  
95f787685a224e Miquel Raynal 2017-10-13  907  		mvuart->irq[UART_TX_IRQ] = irq;
95f787685a224e Miquel Raynal 2017-10-13  908  	}
95f787685a224e Miquel Raynal 2017-10-13  909  
9c3d3ee1239bab Allen Yan     2017-10-13  910  	/* UART Soft Reset*/
9c3d3ee1239bab Allen Yan     2017-10-13  911  	writel(CTRL_SOFT_RST, port->membase + UART_CTRL(port));
9c3d3ee1239bab Allen Yan     2017-10-13  912  	udelay(1);
9c3d3ee1239bab Allen Yan     2017-10-13  913  	writel(0, port->membase + UART_CTRL(port));
9c3d3ee1239bab Allen Yan     2017-10-13  914  
30530791a7a032 Wilson Ding   2016-02-16 @915  	ret = uart_add_one_port(&mvebu_uart_driver, port);
30530791a7a032 Wilson Ding   2016-02-16  916  	if (ret)
30530791a7a032 Wilson Ding   2016-02-16 @917  		return ret;
30530791a7a032 Wilson Ding   2016-02-16  918  	return 0;
30530791a7a032 Wilson Ding   2016-02-16  919  }
30530791a7a032 Wilson Ding   2016-02-16  920  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[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