Re: [PATCH v2 4/6] regulator: Add support for MediaTek MT6363 SPMI PMIC Regulators

From: kernel test robot
Date: Sun Jul 06 2025 - 02:22:34 EST


Hi AngeloGioacchino,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on linus/master v6.16-rc4 next-20250704]
[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/AngeloGioacchino-Del-Regno/dt-bindings-regulator-Document-MediaTek-MT6316-PMIC-Regulators/20250624-154048
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
patch link: https://lore.kernel.org/r/20250624073548.29732-5-angelogioacchino.delregno%40collabora.com
patch subject: [PATCH v2 4/6] regulator: Add support for MediaTek MT6363 SPMI PMIC Regulators
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20250706/202507061437.VKBqvJPn-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250706/202507061437.VKBqvJPn-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/202507061437.VKBqvJPn-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

drivers/regulator/mt6363-regulator.c:375:14: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
375 | } else if (cur_mode == REGULATOR_MODE_IDLE) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/mt6363-regulator.c:388:6: note: uninitialized use occurs here
388 | if (ret) {
| ^~~
drivers/regulator/mt6363-regulator.c:375:10: note: remove the 'if' if its condition is always true
375 | } else if (cur_mode == REGULATOR_MODE_IDLE) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/regulator/mt6363-regulator.c:347:19: note: initialize the variable 'ret' to silence this warning
347 | int cur_mode, ret;
| ^
| = 0
drivers/regulator/mt6363-regulator.c:351:28: warning: variable 'regmap' is uninitialized when used here [-Wuninitialized]
351 | ret = mt6363_buck_unlock(regmap, true);
| ^~~~~~
drivers/regulator/mt6363-regulator.c:346:23: note: initialize the variable 'regmap' to silence this warning
346 | struct regmap *regmap;
| ^
| = NULL
>> drivers/regulator/mt6363-regulator.c:455:9: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
455 | sel = FIELD_PREP(MT6363_RG_VEMC_VOSEL_1_MASK, sel);
| ^
>> drivers/regulator/mt6363-regulator.c:487:9: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
487 | ret = FIELD_GET(MT6363_RG_VEMC_VOSEL_1_MASK, sel);
| ^
2 warnings and 2 errors generated.


vim +/FIELD_PREP +455 drivers/regulator/mt6363-regulator.c

430
431 static int mt6363_vemc_set_voltage_sel(struct regulator_dev *rdev, unsigned int sel)
432 {
433 const u16 tma_unlock_key = MT6363_TMA_UNLOCK_VALUE;
434 struct regmap *regmap = rdev->regmap;
435 unsigned int val;
436 u16 mask;
437 int ret;
438
439 ret = regmap_read(rdev->regmap, MT6363_TOP_TRAP, &val);
440 if (ret)
441 return ret;
442
443 if (val > 1)
444 return -EINVAL;
445
446 /* Unlock TMA for writing */
447 ret = regmap_bulk_write(rdev->regmap, MT6363_TOP_TMA_KEY_L,
448 &tma_unlock_key, sizeof(tma_unlock_key));
449 if (ret)
450 return ret;
451
452 /* If HW trapping value is 1, use VEMC_VOSEL_1 instead of VEMC_VOSEL_0 */
453 if (val == 1) {
454 mask = MT6363_RG_VEMC_VOSEL_1_MASK;
> 455 sel = FIELD_PREP(MT6363_RG_VEMC_VOSEL_1_MASK, sel);
456 } else {
457 mask = rdev->desc->vsel_mask;
458 }
459
460 /* Function must return the result of this write operation */
461 ret = regmap_update_bits(regmap, rdev->desc->vsel_reg, mask, sel);
462
463 /* Unconditionally re-lock TMA */
464 val = 0;
465 regmap_bulk_write(rdev->regmap, MT6363_TOP_TMA_KEY_L, &val, 2);
466
467 return ret;
468 }
469
470 static int mt6363_vemc_get_voltage_sel(struct regulator_dev *rdev)
471 {
472 unsigned int sel, trap;
473 int ret;
474
475 ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &sel);
476 if (ret)
477 return ret;
478
479 ret = regmap_read(rdev->regmap, MT6363_TOP_TRAP, &trap);
480 if (ret)
481 return ret;
482
483 /* If HW trapping value is 1, use VEMC_VOSEL_1 instead of VEMC_VOSEL_0 */
484 if (trap > 1)
485 return -EINVAL;
486 else if (trap == 1)
> 487 ret = FIELD_GET(MT6363_RG_VEMC_VOSEL_1_MASK, sel);
488 else
489 ret = sel & rdev->desc->vsel_mask;
490
491 return ret;
492 }
493

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