On Wed, Jan 31, 2024 at 10:37 AM kernel test robot <lkp@xxxxxxxxx> wrote: > > Hi Bartosz, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on brgl/gpio/for-next] > [also build test WARNING on linus/master v6.8-rc2 next-20240131] > [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/Bartosz-Golaszewski/gpio-protect-the-list-of-GPIO-devices-with-SRCU/20240130-205537 > base: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next > patch link: https://lore.kernel.org/r/20240130124828.14678-2-brgl%40bgdev.pl > patch subject: [PATCH 01/22] gpio: protect the list of GPIO devices with SRCU > config: i386-randconfig-141-20240131 (https://download.01.org/0day-ci/archive/20240131/202401311746.be3dlVTg-lkp@xxxxxxxxx/config) > compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@xxxxxxxxx> > | Closes: https://lore.kernel.org/oe-kbuild-all/202401311746.be3dlVTg-lkp@xxxxxxxxx/ > > New smatch warnings: > drivers/gpio/gpiolib.c:4167 gpiod_find_and_request() error: uninitialized symbol 'ret'. > drivers/gpio/gpiolib.c:4181 gpiod_find_and_request() error: uninitialized symbol 'desc'. > > Old smatch warnings: > drivers/gpio/gpiolib.c:4184 gpiod_find_and_request() error: uninitialized symbol 'desc'. > > vim +/ret +4167 drivers/gpio/gpiolib.c > > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4128 > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4129 static struct gpio_desc *gpiod_find_and_request(struct device *consumer, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4130 struct fwnode_handle *fwnode, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4131 const char *con_id, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4132 unsigned int idx, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4133 enum gpiod_flags flags, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4134 const char *label, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4135 bool platform_lookup_allowed) > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4136 { > ba2dc1cb5491712 Hans de Goede 2022-12-29 4137 unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT; > c122f461ccac0e7 Andy Shevchenko 2023-03-09 4138 struct gpio_desc *desc; > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4139 int ret; > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4140 > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4141 scoped_guard(srcu, &gpio_devices_srcu) { > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4142 desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx, > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4143 &flags, &lookupflags); > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4144 if (gpiod_not_found(desc) && platform_lookup_allowed) { > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4145 /* > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4146 * Either we are not using DT or ACPI, or their lookup > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4147 * did not return a result. In that case, use platform > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4148 * lookup as a fallback. > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4149 */ > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4150 dev_dbg(consumer, > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4151 "using lookup tables for GPIO lookup\n"); > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4152 desc = gpiod_find(consumer, con_id, idx, &lookupflags); > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4153 } > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4154 > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4155 if (IS_ERR(desc)) { > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4156 dev_dbg(consumer, "No GPIO consumer %s found\n", > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4157 con_id); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4158 return desc; > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4159 } > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4160 > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4161 /* > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4162 * If a connection label was passed use that, else attempt to use > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4163 * the device name as label > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4164 */ > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4165 ret = gpiod_request(desc, label); > 1fe5210a1bfba00 Bartosz Golaszewski 2024-01-30 4166 } > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 @4167 if (ret) { > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4168 if (!(ret == -EBUSY && flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4169 return ERR_PTR(ret); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4170 > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4171 /* > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4172 * This happens when there are several consumers for > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4173 * the same GPIO line: we just return here without > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4174 * further initialization. It is a bit of a hack. > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4175 * This is necessary to support fixed regulators. > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4176 * > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4177 * FIXME: Make this more sane and safe. > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4178 */ > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4179 dev_info(consumer, > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4180 "nonexclusive access to GPIO for %s\n", con_id); > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 @4181 return desc; > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4182 } > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4183 > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4184 ret = gpiod_configure_flags(desc, con_id, lookupflags, flags); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4185 if (ret < 0) { > 8eb1f71e7acca4f Dmitry Torokhov 2022-11-11 4186 dev_dbg(consumer, "setup of GPIO %s failed\n", con_id); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4187 gpiod_put(desc); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4188 return ERR_PTR(ret); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4189 } > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4190 > 9ce4ed5b4db1363 Bartosz Golaszewski 2023-08-21 4191 gpiod_line_state_notify(desc, GPIOLINE_CHANGED_REQUESTED); > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4192 > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4193 return desc; > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4194 } > 0eadd36d9123745 Dmitry Torokhov 2022-09-03 4195 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki This is a false-positive coming from the fact the scoped_guard() is implemented as a for loop. I will initialize the variables anyway to make smatch happy. Bart