Re: [PATCH 2/2] power: supply: max17040: Support compatible devices
From: kernel test robot
Date: Mon Jun 08 2020 - 20:20:41 EST
Hi Iskren,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on power-supply/for-next]
[also build test WARNING on next-20200608]
[cannot apply to v5.7]
[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/Iskren-Chernev/dt-bindints-power-supply-Document-max17040-extensions/20200609-022950
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project e429cffd4f228f70c1d9df0e5d77c08590dd9766)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/power/supply/max17040_battery.c:456:13: warning: cast to smaller integer type 'enum chip_id' from 'const void *' [-Wvoid-pointer-to-enum-cast]
chip_id = (enum chip_id) of_device_get_match_data(&client->dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
vim +456 drivers/power/supply/max17040_battery.c
430
431 static int max17040_probe(struct i2c_client *client,
432 const struct i2c_device_id *id)
433 {
434 struct i2c_adapter *adapter = client->adapter;
435 struct power_supply_config psy_cfg = {};
436 struct max17040_chip *chip;
437 enum chip_id chip_id;
438 bool enable_irq = false;
439 int ret;
440
441 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
442 return -EIO;
443
444 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
445 if (!chip)
446 return -ENOMEM;
447
448 chip->client = client;
449 chip->regmap = devm_regmap_init_i2c(client, &max17040_regmap);
450 chip->pdata = client->dev.platform_data;
451 chip_id = (enum chip_id) id->driver_data;
452 if (client->dev.of_node) {
453 ret = max17040_get_of_data(chip);
454 if (ret)
455 return ret;
> 456 chip_id = (enum chip_id) of_device_get_match_data(&client->dev);
457 }
458 chip->data = max17040_family[chip_id];
459
460 i2c_set_clientdata(client, chip);
461 psy_cfg.drv_data = chip;
462
463 chip->battery = devm_power_supply_register(&client->dev,
464 &max17040_battery_desc, &psy_cfg);
465 if (IS_ERR(chip->battery)) {
466 dev_err(&client->dev, "failed: power supply register\n");
467 return PTR_ERR(chip->battery);
468 }
469
470 max17040_reset(chip);
471 max17040_get_version(chip);
472 max17040_set_rcomp(chip, chip->rcomp);
473
474 /* check interrupt */
475 if (client->irq && chip->data.has_low_soc_alert) {
476 ret = max17040_set_low_soc_alert(chip, chip->low_soc_alert);
477 if (ret) {
478 dev_err(&client->dev,
479 "Failed to set low SOC alert: err %d\n", ret);
480 return ret;
481 }
482 enable_irq = true;
483 }
484
485 if (client->irq && chip->data.has_soc_alert) {
486 ret = max17040_set_soc_alert(chip, 1);
487 if (ret) {
488 dev_err(&client->dev,
489 "Failed to set SOC alert: err %d\n", ret);
490 return ret;
491 }
492 enable_irq = true;
493 } else {
494 /* soc alerts negate the need for polling */
495 INIT_DEFERRABLE_WORK(&chip->work, max17040_work);
496 ret = devm_add_action(&client->dev, max17040_stop_work, chip);
497 if (ret)
498 return ret;
499 max17040_queue_work(chip);
500 }
501
502 if (enable_irq) {
503 ret = max17040_setup_irq(chip);
504 if (ret) {
505 client->irq = 0;
506 dev_warn(&client->dev,
507 "Failed to get IRQ err %d\n", ret);
508 }
509 }
510
511 return 0;
512 }
513
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip