Re: [PATCH v10 1/1] serial: core: Start managing serial controllers to enable runtime PM

From: kernel test robot
Date: Mon May 08 2023 - 19:13:56 EST


Hi Tony,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.4-rc1 next-20230508]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Tony-Lindgren/serial-core-Start-managing-serial-controllers-to-enable-runtime-PM/20230508-190805
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20230508110339.38699-1-tony%40atomide.com
patch subject: [PATCH v10 1/1] serial: core: Start managing serial controllers to enable runtime PM
config: x86_64-randconfig-a001-20230508 (https://download.01.org/0day-ci/archive/20230509/202305090752.w4XZxmsN-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/intel-lab-lkp/linux/commit/2f298f9dbe3a1d9550e1f15bb1415aeaf9ce4311
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Tony-Lindgren/serial-core-Start-managing-serial-controllers-to-enable-runtime-PM/20230508-190805
git checkout 2f298f9dbe3a1d9550e1f15bb1415aeaf9ce4311
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/tty/serial/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305090752.w4XZxmsN-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/tty/serial/serial_base_bus.c:97:13: warning: variable 'id' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (type == &serial_port_type) {
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/serial_base_bus.c:102:77: note: uninitialized use occurs here
err = dev_set_name(&sbd->dev, "%s.%s.%d", type->name, dev_name(port->dev), id);
^~
drivers/tty/serial/serial_base_bus.c:97:9: note: remove the 'if' if its condition is always true
} else if (type == &serial_port_type) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/serial_base_bus.c:83:13: note: initialize the variable 'id' to silence this warning
int err, id;
^
= 0
1 warning generated.


vim +97 drivers/tty/serial/serial_base_bus.c

77
78 static struct device *serial_base_device_add(struct uart_port *port,
79 struct device *parent_dev,
80 const struct device_type *type)
81 {
82 struct serial_base_device *sbd;
83 int err, id;
84
85 sbd = kzalloc(sizeof(*sbd), GFP_KERNEL);
86 if (!sbd)
87 return NULL;
88
89 device_initialize(&sbd->dev);
90 sbd->dev.type = type;
91 sbd->dev.parent = parent_dev;
92 sbd->dev.bus = &serial_base_bus_type;
93 sbd->dev.release = &serial_base_release;
94
95 if (type == &serial_ctrl_type) {
96 id = port->ctrl_id;
> 97 } else if (type == &serial_port_type) {
98 id = port->line;
99 sbd->port = port;
100 }
101
102 err = dev_set_name(&sbd->dev, "%s.%s.%d", type->name, dev_name(port->dev), id);
103 if (err)
104 goto err_free_dev;
105
106 err = device_add(&sbd->dev);
107 if (err)
108 goto err_put_device;
109
110 return &sbd->dev;
111
112 err_put_device:
113 put_device(&sbd->dev);
114
115 err_free_dev:
116 kfree(sbd);
117
118 return NULL;
119 }
120

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