Re: [PATCH v3 3/4] regulator: mpq7920: add mpq7920 regulator driver

From: kbuild test robot
Date: Wed Dec 25 2019 - 17:00:14 EST


Hi Saravanan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on regulator/for-next]
[also build test WARNING on robh/for-next linus/master v5.5-rc3 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Saravanan-Sekar/Add-regulator-support-for-mpq7920/20191225-005026
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-129-g341daf20-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/regulator/mpq7920.c:339:44: sparse: sparse: Using plain integer as NULL pointer
>> drivers/regulator/mpq7920.c:317:21: sparse: sparse: incorrect type in assignment (different modifiers)
>> drivers/regulator/mpq7920.c:317:21: sparse: expected struct regulator_ops *ops
>> drivers/regulator/mpq7920.c:317:21: sparse: got struct regulator_ops const *ops

vim +339 drivers/regulator/mpq7920.c

306
307 static inline int mpq7920_regulator_register(
308 struct mpq7920_regulator_info *info,
309 struct regulator_config *config)
310 {
311 int i;
312 struct regulator_desc *rdesc;
313 struct regulator_ops *ops;
314
315 for (i = 0; i < MPQ7920_MAX_REGULATORS; i++) {
316 rdesc = &info->rdesc[i];
> 317 ops = rdesc->ops;
318 if (rdesc->curr_table) {
319 ops->get_current_limit =
320 regulator_get_current_limit_regmap;
321 ops->set_current_limit =
322 regulator_set_current_limit_regmap;
323 }
324
325 info->rdev[i] = devm_regulator_register(info->dev, rdesc,
326 config);
327 if (IS_ERR(info->rdev))
328 return PTR_ERR(info->rdev);
329 }
330
331 return 0;
332 }
333
334 static int mpq7920_i2c_probe(struct i2c_client *client,
335 const struct i2c_device_id *id)
336 {
337 struct device *dev = &client->dev;
338 struct mpq7920_regulator_info *info;
> 339 struct regulator_config config = { 0 };
340 struct regmap *regmap;
341 int ret;
342
343 info = devm_kzalloc(dev, sizeof(struct mpq7920_regulator_info),
344 GFP_KERNEL);
345 if (!info)
346 return -ENOMEM;
347
348 info->dev = dev;
349 info->rdesc = mpq7920_regulators_desc;
350 regmap = devm_regmap_init_i2c(client, &mpq7920_regmap_config);
351 if (IS_ERR(regmap)) {
352 dev_err(dev, "Failed to allocate regmap!\n");
353 return PTR_ERR(regmap);
354 }
355
356 i2c_set_clientdata(client, info);
357 info->regmap = regmap;
358 if (client->dev.of_node)
359 mpq7920_parse_dt(&client->dev, info);
360
361 config.dev = info->dev;
362 config.regmap = regmap;
363 config.driver_data = info;
364
365 ret = mpq7920_regulator_register(info, &config);
366 if (ret < 0)
367 dev_err(dev, "Failed to register regulator!\n");
368
369 return ret;
370 }
371

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation