Re: [PATCH] gpio: ds4520: don't check the 'ngpios' property in the driver

From: kernel test robot
Date: Mon Apr 07 2025 - 12:25:44 EST


Hi Bartosz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0af2f6be1b4281385b618cb86ad946eded089ac8]

url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/gpio-ds4520-don-t-check-the-ngpios-property-in-the-driver/20250407-150804
base: 0af2f6be1b4281385b618cb86ad946eded089ac8
patch link: https://lore.kernel.org/r/20250407-gpio-regmap-ngpios-v1-1-5ea63fcbde39%40linaro.org
patch subject: [PATCH] gpio: ds4520: don't check the 'ngpios' property in the driver
config: arm-randconfig-002-20250407 (https://download.01.org/0day-ci/archive/20250407/202504072320.SjnRj58d-lkp@xxxxxxxxx/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 92c93f5286b9ff33f27ff694d2dc33da1c07afdd)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250407/202504072320.SjnRj58d-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/202504072320.SjnRj58d-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-ds4520.c:43:17: warning: variable 'ngpio' is uninitialized when used here [-Wuninitialized]
43 | config.ngpio = ngpio;
| ^~~~~
drivers/gpio/gpio-ds4520.c:28:11: note: initialize the variable 'ngpio' to silence this warning
28 | u32 ngpio;
| ^
| = 0
1 warning generated.


vim +/ngpio +43 drivers/gpio/gpio-ds4520.c

659ad5f7efece8 Okan Sahin 2023-07-29 22
659ad5f7efece8 Okan Sahin 2023-07-29 23 static int ds4520_gpio_probe(struct i2c_client *client)
659ad5f7efece8 Okan Sahin 2023-07-29 24 {
659ad5f7efece8 Okan Sahin 2023-07-29 25 struct gpio_regmap_config config = { };
659ad5f7efece8 Okan Sahin 2023-07-29 26 struct device *dev = &client->dev;
659ad5f7efece8 Okan Sahin 2023-07-29 27 struct regmap *regmap;
659ad5f7efece8 Okan Sahin 2023-07-29 28 u32 ngpio;
659ad5f7efece8 Okan Sahin 2023-07-29 29 u32 base;
659ad5f7efece8 Okan Sahin 2023-07-29 30 int ret;
659ad5f7efece8 Okan Sahin 2023-07-29 31
659ad5f7efece8 Okan Sahin 2023-07-29 32 ret = device_property_read_u32(dev, "reg", &base);
659ad5f7efece8 Okan Sahin 2023-07-29 33 if (ret)
659ad5f7efece8 Okan Sahin 2023-07-29 34 return dev_err_probe(dev, ret, "Missing 'reg' property.\n");
659ad5f7efece8 Okan Sahin 2023-07-29 35
659ad5f7efece8 Okan Sahin 2023-07-29 36 regmap = devm_regmap_init_i2c(client, &ds4520_regmap_config);
659ad5f7efece8 Okan Sahin 2023-07-29 37 if (IS_ERR(regmap))
659ad5f7efece8 Okan Sahin 2023-07-29 38 return dev_err_probe(dev, PTR_ERR(regmap),
659ad5f7efece8 Okan Sahin 2023-07-29 39 "Failed to allocate register map\n");
659ad5f7efece8 Okan Sahin 2023-07-29 40
659ad5f7efece8 Okan Sahin 2023-07-29 41 config.regmap = regmap;
659ad5f7efece8 Okan Sahin 2023-07-29 42 config.parent = dev;
659ad5f7efece8 Okan Sahin 2023-07-29 @43 config.ngpio = ngpio;
659ad5f7efece8 Okan Sahin 2023-07-29 44
659ad5f7efece8 Okan Sahin 2023-07-29 45 config.reg_dat_base = base + DS4520_IO_STATUS0;
659ad5f7efece8 Okan Sahin 2023-07-29 46 config.reg_set_base = base + DS4520_PULLUP0;
659ad5f7efece8 Okan Sahin 2023-07-29 47 config.reg_dir_out_base = base + DS4520_IO_CONTROL0;
659ad5f7efece8 Okan Sahin 2023-07-29 48
659ad5f7efece8 Okan Sahin 2023-07-29 49 return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &config));
659ad5f7efece8 Okan Sahin 2023-07-29 50 }
659ad5f7efece8 Okan Sahin 2023-07-29 51

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