Re: [PATCH v4 4/7] power: supply: max17040: Support compatible devices

From: kernel test robot
Date: Mon Sep 07 2020 - 02:48:57 EST


Hi Iskren,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on b36c969764ab12faebb74711c942fa3e6eaf1e96]

url: https://github.com/0day-ci/linux/commits/Iskren-Chernev/power-supply-max17040-support-compatible-devices/20200907-112145
base: b36c969764ab12faebb74711c942fa3e6eaf1e96
config: x86_64-randconfig-r026-20200907 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ab68517e6b7e51b84c4b0e813a30258ec1ce5da5)
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 >>):

>> drivers/power/supply/max17040_battery.c:410: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.

# https://github.com/0day-ci/linux/commit/20c853834c05ddde6df590b46b94ef66477df1d0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Iskren-Chernev/power-supply-max17040-support-compatible-devices/20200907-112145
git checkout 20c853834c05ddde6df590b46b94ef66477df1d0
vim +410 drivers/power/supply/max17040_battery.c

385
386 static int max17040_probe(struct i2c_client *client,
387 const struct i2c_device_id *id)
388 {
389 struct i2c_adapter *adapter = client->adapter;
390 struct power_supply_config psy_cfg = {};
391 struct max17040_chip *chip;
392 enum chip_id chip_id;
393 int ret;
394
395 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
396 return -EIO;
397
398 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
399 if (!chip)
400 return -ENOMEM;
401
402 chip->client = client;
403 chip->regmap = devm_regmap_init_i2c(client, &max17040_regmap);
404 chip->pdata = client->dev.platform_data;
405 chip_id = (enum chip_id) id->driver_data;
406 if (client->dev.of_node) {
407 ret = max17040_get_of_data(chip);
408 if (ret)
409 return ret;
> 410 chip_id = (enum chip_id) of_device_get_match_data(&client->dev);
411 }
412 chip->data = max17040_family[chip_id];
413
414 i2c_set_clientdata(client, chip);
415 psy_cfg.drv_data = chip;
416
417 chip->battery = devm_power_supply_register(&client->dev,
418 &max17040_battery_desc, &psy_cfg);
419 if (IS_ERR(chip->battery)) {
420 dev_err(&client->dev, "failed: power supply register\n");
421 return PTR_ERR(chip->battery);
422 }
423
424 ret = max17040_get_version(chip);
425 if (ret < 0)
426 return ret;
427 dev_dbg(&chip->client->dev, "MAX17040 Fuel-Gauge Ver 0x%x\n", ret);
428
429 if (chip_id == ID_MAX17040 || chip_id == ID_MAX17041)
430 max17040_reset(chip);
431
432 /* check interrupt */
433 if (client->irq && chip->data.has_low_soc_alert) {
434 ret = max17040_set_low_soc_alert(chip, chip->low_soc_alert);
435 if (ret) {
436 dev_err(&client->dev,
437 "Failed to set low SOC alert: err %d\n", ret);
438 return ret;
439 }
440
441 ret = max17040_enable_alert_irq(chip);
442 if (ret) {
443 client->irq = 0;
444 dev_warn(&client->dev,
445 "Failed to get IRQ err %d\n", ret);
446 }
447 }
448
449 INIT_DEFERRABLE_WORK(&chip->work, max17040_work);
450 ret = devm_add_action(&client->dev, max17040_stop_work, chip);
451 if (ret)
452 return ret;
453 max17040_queue_work(chip);
454
455 return 0;
456 }
457

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip