drivers/regulator/da9121-regulator.c:1133:24: warning: cast to smaller integer type 'enum da9121_subvariant' from 'const void *'

From: kernel test robot
Date: Tue Dec 03 2024 - 00:43:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cdd30ebb1b9f36159d66f088b61aee264e649d7a
commit: 46537a8676d6555141c4b98ec1bf5f3eea971128 regulator: da9121: Use i2c_get_match_data()
date: 1 year, 2 months ago
config: x86_64-randconfig-001-20240106 (https://download.01.org/0day-ci/archive/20241203/202412031346.i4MX8xOA-lkp@xxxxxxxxx/config)
compiler: ClangBuiltLinux 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/20241203/202412031346.i4MX8xOA-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/202412031346.i4MX8xOA-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/regulator/da9121-regulator.c:1133:24: warning: cast to smaller integer type 'enum da9121_subvariant' from 'const void *' [-Wvoid-pointer-to-enum-cast]
1133 | chip->subvariant_id = (enum da9121_subvariant)i2c_get_match_data(i2c);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.


vim +1133 drivers/regulator/da9121-regulator.c

1119
1120 static int da9121_i2c_probe(struct i2c_client *i2c)
1121 {
1122 struct da9121 *chip;
1123 const int mask_all[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
1124 int ret = 0;
1125
1126 chip = devm_kzalloc(&i2c->dev, sizeof(struct da9121), GFP_KERNEL);
1127 if (!chip) {
1128 ret = -ENOMEM;
1129 goto error;
1130 }
1131
1132 chip->pdata = i2c->dev.platform_data;
> 1133 chip->subvariant_id = (enum da9121_subvariant)i2c_get_match_data(i2c);
1134
1135 ret = da9121_assign_chip_model(i2c, chip);
1136 if (ret < 0)
1137 goto error;
1138
1139 ret = regmap_bulk_write(chip->regmap, DA9121_REG_SYS_MASK_0, mask_all, 4);
1140 if (ret != 0) {
1141 dev_err(chip->dev, "Failed to set IRQ masks: %d\n", ret);
1142 goto error;
1143 }
1144
1145 ret = da9121_set_regulator_config(chip);
1146 if (ret < 0)
1147 goto error;
1148
1149 ret = da9121_config_irq(i2c, chip);
1150
1151 error:
1152 return ret;
1153 }
1154

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