drivers/regulator/tps65219-regulator.c:310:60: warning: parameter 'dev' set but not used
From: kernel test robot
Date: Thu Feb 23 2023 - 10:06:33 EST
Hi Jerome,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a5c95ca18a98d742d0a4a04063c32556b5b66378
commit: 74c17a0a49a6ad3b32cb130f25196d1f8d5d560e mfd: tps65219: Add driver for TI TPS65219 PMIC
date: 3 months ago
config: alpha-buildonly-randconfig-r004-20230222 (https://download.01.org/0day-ci/archive/20230223/202302232247.r8w2oeDy-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 12.1.0
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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=74c17a0a49a6ad3b32cb130f25196d1f8d5d560e
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 74c17a0a49a6ad3b32cb130f25196d1f8d5d560e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/regulator/
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/202302232247.r8w2oeDy-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/regulator/tps65219-regulator.c: In function 'tps65219_get_rdev_by_name':
>> drivers/regulator/tps65219-regulator.c:310:60: warning: parameter 'dev' set but not used [-Wunused-but-set-parameter]
310 | struct regulator_dev *dev)
| ~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/regulator/tps65219-regulator.c: In function 'tps65219_regulator_probe':
>> drivers/regulator/tps65219-regulator.c:370:26: warning: ordered comparison of pointer with integer zero [-Wextra]
370 | if (rdev < 0) {
| ^
vim +/dev +310 drivers/regulator/tps65219-regulator.c
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 307
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 308 static int tps65219_get_rdev_by_name(const char *regulator_name,
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 309 struct regulator_dev *rdevtbl[7],
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 @310 struct regulator_dev *dev)
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 311 {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 312 int i;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 313
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 314 for (i = 0; i < ARRAY_SIZE(regulators); i++) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 315 if (strcmp(regulator_name, regulators[i].name) == 0) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 316 dev = rdevtbl[i];
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 317 return 0;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 318 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 319 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 320 return -EINVAL;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 321 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 322
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 323 static int tps65219_regulator_probe(struct platform_device *pdev)
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 324 {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 325 struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 326 struct regulator_dev *rdev;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 327 struct regulator_config config = { };
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 328 int i;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 329 int error;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 330 int irq;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 331 struct tps65219_regulator_irq_data *irq_data;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 332 struct tps65219_regulator_irq_type *irq_type;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 333 struct regulator_dev *rdevtbl[7];
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 334
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 335 config.dev = tps->dev;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 336 config.driver_data = tps;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 337 config.regmap = tps->regmap;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 338
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 339 for (i = 0; i < ARRAY_SIZE(regulators); i++) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 340 dev_dbg(tps->dev, "%s regul i= %d START", __func__, i);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 341 rdev = devm_regulator_register(&pdev->dev, ®ulators[i],
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 342 &config);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 343 if (IS_ERR(rdev)) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 344 dev_err(tps->dev, "failed to register %s regulator\n",
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 345 pdev->name);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 346 return PTR_ERR(rdev);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 347 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 348 rdevtbl[i] = rdev;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 349 dev_dbg(tps->dev, "%s regul i= %d COMPLETED", __func__, i);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 350 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 351
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 352 irq_data = devm_kmalloc(tps->dev,
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 353 ARRAY_SIZE(tps65219_regulator_irq_types) *
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 354 sizeof(struct tps65219_regulator_irq_data),
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 355 GFP_KERNEL);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 356 if (!irq_data)
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 357 return -ENOMEM;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 358
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 359 for (i = 0; i < ARRAY_SIZE(tps65219_regulator_irq_types); ++i) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 360 irq_type = &tps65219_regulator_irq_types[i];
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 361
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 362 irq = platform_get_irq_byname(pdev, irq_type->irq_name);
d46f737208a45d Yang Li 2022-08-25 363 if (irq < 0)
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 364 return -EINVAL;
d46f737208a45d Yang Li 2022-08-25 365
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 366 irq_data[i].dev = tps->dev;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 367 irq_data[i].type = irq_type;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 368
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 369 tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 @370 if (rdev < 0) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 371 dev_err(tps->dev, "Failed to get rdev for %s\n",
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 372 irq_type->regulator_name);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 373 return -EINVAL;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 374 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 375 irq_data[i].rdev = rdev;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 376
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 377 error = devm_request_threaded_irq(tps->dev, irq, NULL,
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 378 tps65219_regulator_irq_handler,
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 379 IRQF_ONESHOT,
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 380 irq_type->irq_name,
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 381 &irq_data[i]);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 382 if (error) {
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 383 dev_err(tps->dev, "failed to request %s IRQ %d: %d\n",
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 384 irq_type->irq_name, irq, error);
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 385 return error;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 386 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 387 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 388
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 389 return 0;
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 390 }
c12ac5fc3e0af2 Jerome Neanne 2022-08-05 391
:::::: The code at line 310 was first introduced by commit
:::::: c12ac5fc3e0af29851785e557e243663b4fc7f4b regulator: drivers: Add TI TPS65219 PMIC regulators support
:::::: TO: Jerome Neanne <jneanne@xxxxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests