Re: [PATCH v3 2/3] gpio: pcie-idio-24: Migrate to the regmap API

From: kernel test robot
Date: Sun Mar 05 2023 - 15:04:05 EST


Hi William,

I love your patch! Perhaps something to improve:

[auto build test WARNING on 4827aae061337251bb91801b316157a78b845ec7]

url: https://github.com/intel-lab-lkp/linux/commits/William-Breathitt-Gray/regmap-Pass-irq_drv_data-as-a-parameter-for-set_type_config/20230306-010313
base: 4827aae061337251bb91801b316157a78b845ec7
patch link: https://lore.kernel.org/r/278e328cd1689a4e331e7515050c12c29f2a4785.1678034378.git.william.gray%40linaro.org
patch subject: [PATCH v3 2/3] gpio: pcie-idio-24: Migrate to the regmap API
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20230306/202303060355.RtbgFd25-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/e60d5c32ff098c33b1e171190079ed3f40180008
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review William-Breathitt-Gray/regmap-Pass-irq_drv_data-as-a-parameter-for-set_type_config/20230306-010313
git checkout e60d5c32ff098c33b1e171190079ed3f40180008
# 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=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpio/

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/202303060355.RtbgFd25-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/gpio/gpio-pcie-idio-24.c:365:2: warning: variable 'idio24gpio' is uninitialized when used here [-Wuninitialized]
idio24gpio->map = devm_regmap_init_mmio(dev, idio_24_regs,
^~~~~~~~~~
drivers/gpio/gpio-pcie-idio-24.c:333:33: note: initialize the variable 'idio24gpio' to silence this warning
struct idio_24_gpio *idio24gpio;
^
= NULL
1 warning generated.


vim +/idio24gpio +365 drivers/gpio/gpio-pcie-idio-24.c

329
330 static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
331 {
332 struct device *const dev = &pdev->dev;
333 struct idio_24_gpio *idio24gpio;
334 int err;
335 const size_t pci_plx_bar_index = 1;
336 const size_t pci_bar_index = 2;
337 const char *const name = pci_name(pdev);
338 struct gpio_regmap_config gpio_config = {};
339 void __iomem *pex8311_intcsr;
340 void __iomem *idio_24_regs;
341 struct regmap *pex8311_intcsr_map;
342 struct regmap_irq_chip *chip;
343 struct regmap_irq_chip_data *chip_data;
344
345 err = pcim_enable_device(pdev);
346 if (err) {
347 dev_err(dev, "Failed to enable PCI device (%d)\n", err);
348 return err;
349 }
350
351 err = pcim_iomap_regions(pdev, BIT(pci_plx_bar_index) | BIT(pci_bar_index), name);
352 if (err) {
353 dev_err(dev, "Unable to map PCI I/O addresses (%d)\n", err);
354 return err;
355 }
356
357 pex8311_intcsr = pcim_iomap_table(pdev)[pci_plx_bar_index] + PLX_PEX8311_PCI_LCS_INTCSR;
358 idio_24_regs = pcim_iomap_table(pdev)[pci_bar_index];
359
360 pex8311_intcsr_map = devm_regmap_init_mmio(dev, pex8311_intcsr,
361 &pex8311_intcsr_regmap_config);
362 if (IS_ERR(pex8311_intcsr_map))
363 return dev_err_probe(dev, PTR_ERR(pex8311_intcsr_map),
364 "Unable to initialize PEX8311 register map\n");
> 365 idio24gpio->map = devm_regmap_init_mmio(dev, idio_24_regs,
366 &idio_24_regmap_config);
367 if (IS_ERR(idio24gpio->map))
368 return dev_err_probe(dev, PTR_ERR(idio24gpio->map),
369 "Unable to initialize register map\n");
370
371 idio24gpio = devm_kzalloc(dev, sizeof(*idio24gpio), GFP_KERNEL);
372 if (!idio24gpio)
373 return -ENOMEM;
374
375 mutex_init(&idio24gpio->lock);
376
377 /* Initialize all IRQ type configuration to IRQ_TYPE_EDGE_BOTH */
378 idio24gpio->irq_type = GENMASK(7, 0);
379
380 chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
381 if (!chip)
382 return -ENOMEM;
383
384 chip->name = name;
385 chip->status_base = IDIO_24_COS_STATUS_BASE;
386 chip->mask_base = IDIO_24_COS_ENABLE;
387 chip->ack_base = IDIO_24_COS_STATUS_BASE;
388 chip->num_regs = 4;
389 chip->irqs = idio_24_regmap_irqs;
390 chip->num_irqs = ARRAY_SIZE(idio_24_regmap_irqs);
391 chip->handle_mask_sync = idio_24_handle_mask_sync;
392 chip->set_type_config = idio_24_set_type_config;
393 chip->irq_drv_data = idio24gpio;
394
395 /* Software board reset */
396 err = regmap_write(idio24gpio->map, IDIO_24_SOFT_RESET, 0);
397 if (err)
398 return err;
399 /*
400 * enable PLX PEX8311 internal PCI wire interrupt and local interrupt
401 * input
402 */
403 err = regmap_update_bits(pex8311_intcsr_map, 0x0, IDIO_24_ENABLE_IRQ,
404 IDIO_24_ENABLE_IRQ);
405 if (err)
406 return err;
407
408 err = devm_regmap_add_irq_chip(dev, idio24gpio->map, pdev->irq, 0, 0,
409 chip, &chip_data);
410 if (err)
411 return dev_err_probe(dev, err, "IRQ registration failed\n");
412
413 gpio_config.parent = dev;
414 gpio_config.regmap = idio24gpio->map;
415 gpio_config.ngpio = IDIO_24_NGPIO;
416 gpio_config.names = idio_24_names;
417 gpio_config.reg_dat_base = GPIO_REGMAP_ADDR(IDIO_24_OUT_BASE);
418 gpio_config.reg_set_base = GPIO_REGMAP_ADDR(IDIO_24_OUT_BASE);
419 gpio_config.reg_dir_out_base = GPIO_REGMAP_ADDR(IDIO_24_CONTROL_REG);
420 gpio_config.ngpio_per_reg = IDIO_24_NGPIO_PER_REG;
421 gpio_config.irq_domain = regmap_irq_get_domain(chip_data);
422 gpio_config.reg_mask_xlate = idio_24_reg_mask_xlate;
423 gpio_config.drvdata = idio24gpio->map;
424
425 return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config));
426 }
427

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