Re: [PATCH 2/6] gpio: move hogs into GPIO core
From: kernel test robot
Date: Thu Mar 05 2026 - 20:06:44 EST
Hi Bartosz,
kernel test robot noticed the following build warnings:
[auto build test WARNING on c025f6cf4209e1542ec2afebe49f42bbaf1a5c7b]
url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/gpio-of-clear-OF_POPULATED-on-hog-nodes-in-remove-path/20260305-175735
base: c025f6cf4209e1542ec2afebe49f42bbaf1a5c7b
patch link: https://lore.kernel.org/r/20260305-gpio-hog-fwnode-v1-2-97d7df6bbd17%40oss.qualcomm.com
patch subject: [PATCH 2/6] gpio: move hogs into GPIO core
config: loongarch-allnoconfig (https://download.01.org/0day-ci/archive/20260306/202603060850.dUlmPBav-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project c32caeec8158d634bb71ab8911a6031248b9fc47)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260306/202603060850.dUlmPBav-lkp@xxxxxxxxx/reproduce)
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/202603060850.dUlmPBav-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> drivers/gpio/gpiolib.c:981:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
981 | return ret;
| ^~~
drivers/gpio/gpiolib.c:971:9: note: initialize the variable 'ret' to silence this warning
971 | int ret, argc;
| ^
| = 0
1 warning generated.
vim +/ret +981 drivers/gpio/gpiolib.c
962
963 int gpiochip_add_hog(struct gpio_chip *gc, struct fwnode_handle *fwnode)
964 {
965 struct fwnode_handle *gc_node = dev_fwnode(&gc->gpiodev->dev);
966 struct of_phandle_args gpiospec;
967 enum gpiod_flags dflags;
968 struct gpio_desc *desc;
969 unsigned long lflags;
970 const char *name;
971 int ret, argc;
972 u32 gpios[3]; /* We support up to three-cell bindings. */
973 u32 cells;
974
975 lflags = GPIO_LOOKUP_FLAGS_DEFAULT;
976 dflags = GPIOD_ASIS;
977 name = NULL;
978
979 argc = fwnode_property_count_u32(fwnode, "gpios");
980 if (argc < 0)
> 981 return ret;
982 if (argc > 3)
983 return -EINVAL;
984
985 ret = fwnode_property_read_u32_array(fwnode, "gpios", gpios, argc);
986 if (ret < 0)
987 return ret;
988
989 if (is_of_node(fwnode)) {
990 /*
991 * OF-nodes need some additional special handling for
992 * translating of devicetree flags.
993 */
994 ret = fwnode_property_read_u32(gc_node, "#gpio-cells", &cells);
995 if (ret)
996 return ret;
997 if (cells && argc != cells)
998 return -EINVAL;
999
1000 memset(&gpiospec, 0, sizeof(gpiospec));
1001 gpiospec.np = to_of_node(fwnode);
1002 gpiospec.args_count = argc;
1003 memcpy(&gpiospec.args, gpios, argc * sizeof(u32));
1004
1005 ret = of_gpiochip_get_lflags(gc, &gpiospec, &lflags);
1006 if (ret)
1007 return ret;
1008 } else {
1009 /*
1010 * GPIO_ACTIVE_LOW is currently the only lookup flag
1011 * supported for non-OF firmware nodes.
1012 */
1013 if (gpios[1])
1014 lflags |= GPIO_ACTIVE_LOW;
1015 }
1016
1017 if (fwnode_property_present(fwnode, "input"))
1018 dflags |= GPIOD_IN;
1019 else if (fwnode_property_present(fwnode, "output-low"))
1020 dflags |= GPIOD_OUT_LOW;
1021 else if (fwnode_property_present(fwnode, "output-high"))
1022 dflags |= GPIOD_OUT_HIGH;
1023 else
1024 return -EINVAL;
1025
1026 fwnode_property_read_string(fwnode, "line-name", &name);
1027
1028 desc = gpiochip_get_desc(gc, gpios[0]);
1029 if (IS_ERR(desc))
1030 return PTR_ERR(desc);
1031
1032 ret = gpiod_hog(desc, name, lflags, dflags);
1033 if (ret)
1034 return ret;
1035
1036 return 0;
1037 }
1038
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki