Re: [PATCH 1/7] serial: core: Add support of runtime PM

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

 



Hi Tony,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.16-rc1 next-20211116]
[cannot apply to tty/tty-testing]
[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/Tony-Lindgren/Serial-port-generic-PM-to-fix-8250-PM/20211115-164354
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: hexagon-randconfig-r045-20211115 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
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
        # https://github.com/0day-ci/linux/commit/d9568fa846ba1319eacfd03d39b48c3af05fe9f9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tony-Lindgren/Serial-port-generic-PM-to-fix-8250-PM/20211115-164354
        git checkout d9568fa846ba1319eacfd03d39b48c3af05fe9f9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon 

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

All warnings (new ones prefixed by >>):

>> drivers/tty/serial/serial_core.c:2353:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (tty_port_suspended(port)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/serial_core.c:2401:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/tty/serial/serial_core.c:2353:2: note: remove the 'if' if its condition is always true
           if (tty_port_suspended(port)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/tty/serial/serial_core.c:2310:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +2353 drivers/tty/serial/serial_core.c

^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2302  
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2303  int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2304  {
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2305  	struct uart_state *state = drv->state + uport->line;
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2306  	struct tty_port *port = &state->port;
03a74dcc7eebe6 drivers/serial/serial_core.c     Arjan van de Ven      2008-05-23  2307  	struct device *tty_dev;
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2308  	struct uart_match match = {uport, drv};
ba15ab0e8de0d4 drivers/serial/serial_core.c     Deepak Saxena         2009-09-19  2309  	struct ktermios termios;
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2310  	int ret;
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2311  
a2bceae065ed8c drivers/serial/serial_core.c     Alan Cox              2009-09-19  2312  	mutex_lock(&port->mutex);
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2313  
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2314  	tty_dev = device_find_child(uport->dev, &match, serial_match_port);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2315  	if (!uport->suspended && device_may_wakeup(tty_dev)) {
aef3ad103a686f drivers/tty/serial/serial_core.c Andy Shevchenko       2017-08-13  2316  		if (irqd_is_wakeup_set(irq_get_irq_data((uport->irq))))
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2317  			disable_irq_wake(uport->irq);
5a65dcc04cda41 drivers/tty/serial/serial_core.c Federico Vaga         2013-04-15  2318  		put_device(tty_dev);
a2bceae065ed8c drivers/serial/serial_core.c     Alan Cox              2009-09-19  2319  		mutex_unlock(&port->mutex);
b3b708fa2780cd drivers/serial/serial_core.c     Guennadi Liakhovetski 2007-10-16  2320  		return 0;
b3b708fa2780cd drivers/serial/serial_core.c     Guennadi Liakhovetski 2007-10-16  2321  	}
5a65dcc04cda41 drivers/tty/serial/serial_core.c Federico Vaga         2013-04-15  2322  	put_device(tty_dev);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2323  	uport->suspended = 0;
b3b708fa2780cd drivers/serial/serial_core.c     Guennadi Liakhovetski 2007-10-16  2324  
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2325  	/*
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2326  	 * Re-enable the console device after suspending.
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2327  	 */
5933a161abcb8d drivers/tty/serial/serial_core.c Yin Kangkai           2011-01-30  2328  	if (uart_console(uport)) {
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2329  		/*
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2330  		 * First try to use the console cflag setting.
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2331  		 */
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2332  		memset(&termios, 0, sizeof(struct ktermios));
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2333  		termios.c_cflag = uport->cons->cflag;
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2334  
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2335  		/*
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2336  		 * If that's unset, use the tty termios setting.
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2337  		 */
adc8d746caa67f drivers/tty/serial/serial_core.c Alan Cox              2012-07-14  2338  		if (port->tty && termios.c_cflag == 0)
adc8d746caa67f drivers/tty/serial/serial_core.c Alan Cox              2012-07-14  2339  			termios = port->tty->termios;
891b9dd1076435 drivers/serial/serial_core.c     Jason Wang            2010-08-21  2340  
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2341  		ret = serial_pm_resume_and_get(uport->dev);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2342  		if (ret < 0)
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2343  			goto unlock;
94abc56f4d90f2 drivers/tty/serial/serial_core.c Ning Jiang            2011-09-05  2344  		if (console_suspend_enabled)
6f538fe31c1d45 drivers/tty/serial/serial_core.c Linus Walleij         2012-12-07  2345  			uart_change_pm(state, UART_PM_STATE_ON);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2346  		uport->ops->set_termios(uport, &termios, NULL);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2347  		serial_pm_autosuspend(uport->dev);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2348  
5933a161abcb8d drivers/tty/serial/serial_core.c Yin Kangkai           2011-01-30  2349  		if (console_suspend_enabled)
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2350  			console_start(uport->cons);
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2351  	}
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2352  
80f02d5424301b drivers/tty/serial/serial_core.c Peter Hurley          2016-04-09 @2353  	if (tty_port_suspended(port)) {
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2354  		const struct uart_ops *ops = uport->ops;
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2355  
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2356  		ret = serial_pm_resume_and_get(uport->dev);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2357  		if (ret < 0)
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2358  			goto unlock;
6f538fe31c1d45 drivers/tty/serial/serial_core.c Linus Walleij         2012-12-07  2359  		uart_change_pm(state, UART_PM_STATE_ON);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2360  		spin_lock_irq(&uport->lock);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2361  		ops->set_mctrl(uport, 0);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2362  		spin_unlock_irq(&uport->lock);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2363  		serial_pm_autosuspend(uport->dev);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2364  
4547be7809a3b7 drivers/serial/serial_core.c     Stanislav Brabec      2009-12-02  2365  		if (console_suspend_enabled || !uart_console(uport)) {
192251352f912b drivers/serial/serial_core.c     Alan Cox              2010-06-01  2366  			/* Protected by port mutex for now */
192251352f912b drivers/serial/serial_core.c     Alan Cox              2010-06-01  2367  			struct tty_struct *tty = port->tty;
4ed71addf51a62 drivers/tty/serial/serial_core.c Tamseel Shams         2020-07-16  2368  
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2369  			ret = serial_pm_resume_and_get(uport->dev);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2370  			if (ret < 0)
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2371  				goto unlock;
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2372  			ret = ops->startup(uport);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2373  			serial_pm_autosuspend(uport->dev);
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2374  			if (ret == 0) {
192251352f912b drivers/serial/serial_core.c     Alan Cox              2010-06-01  2375  				if (tty)
192251352f912b drivers/serial/serial_core.c     Alan Cox              2010-06-01  2376  					uart_change_speed(tty, state, NULL);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2377  				ret = serial_pm_resume_and_get(uport->dev);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2378  				if (ret < 0)
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2379  					goto unlock;
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2380  				spin_lock_irq(&uport->lock);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2381  				ops->set_mctrl(uport, uport->mctrl);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2382  				ops->start_tx(uport);
ccce6debb62d94 drivers/serial/serial_core.c     Alan Cox              2009-09-19  2383  				spin_unlock_irq(&uport->lock);
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2384  				serial_pm_autosuspend(uport->dev);
d41861ca19c9e9 drivers/tty/serial/serial_core.c Peter Hurley          2016-04-09  2385  				tty_port_set_initialized(port, 1);
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2386  			} else {
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2387  				/*
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2388  				 * Failed to resume - maybe hardware went away?
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2389  				 * Clear the "initialized" flag so we won't try
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2390  				 * to call the low level drivers shutdown method.
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2391  				 */
192251352f912b drivers/serial/serial_core.c     Alan Cox              2010-06-01  2392  				uart_shutdown(tty, state);
ee31b337852ca8 drivers/serial/serial_core.c     Russell King          2005-11-13  2393  			}
4547be7809a3b7 drivers/serial/serial_core.c     Stanislav Brabec      2009-12-02  2394  		}
a6b93a90850881 drivers/serial/serial_core.c     Russell King          2006-10-01  2395  
80f02d5424301b drivers/tty/serial/serial_core.c Peter Hurley          2016-04-09  2396  		tty_port_set_suspended(port, 0);
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2397  	}
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2398  unlock:
a2bceae065ed8c drivers/serial/serial_core.c     Alan Cox              2009-09-19  2399  	mutex_unlock(&port->mutex);
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2400  
d9568fa846ba13 drivers/tty/serial/serial_core.c Andy Shevchenko       2021-11-15  2401  	return ret;
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2402  }
^1da177e4c3f41 drivers/serial/serial_core.c     Linus Torvalds        2005-04-16  2403  

---
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]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux