Re: [PATCH linux dev 6.11] hwmon:add new hwmon driver sq52205

From: kernel test robot
Date: Fri Sep 13 2024 - 01:30:18 EST


Hi Wenliang,

kernel test robot noticed the following build errors:

[auto build test ERROR on linux/master]

url: https://github.com/intel-lab-lkp/linux/commits/Wenliang/hwmon-add-new-hwmon-driver-sq52205/20240912-002906
base: linux/master
patch link: https://lore.kernel.org/r/20240822074426.7241-1-wenliang202407%40163.com
patch subject: [PATCH linux dev 6.11] hwmon:add new hwmon driver sq52205
config: openrisc-randconfig-r072-20240913 (https://download.01.org/0day-ci/archive/20240913/202409131320.Ne0lQtTj-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240913/202409131320.Ne0lQtTj-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/202409131320.Ne0lQtTj-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

drivers/hwmon/sq52205.c: In function 'sq522xx_probe':
>> drivers/hwmon/sq52205.c:493:44: error: assignment of member 'max_register' in read-only object
493 | sq522xx_regmap_config.max_register = data->config->registers;
| ^


vim +/max_register +493 drivers/hwmon/sq52205.c

460
461 static int sq522xx_probe(struct i2c_client *client)
462 {
463 struct device *dev = &client->dev;
464 struct sq522xx_data *data;
465 struct device *hwmon_dev;
466 u32 val;
467 int ret, group = 0;
468 enum sq522xx_ids chip;
469
470 if (client->dev.of_node)
471 chip = (uintptr_t)of_device_get_match_data(&client->dev);
472 else
473 chip = i2c_match_id(sq522xx_id, client)->driver_data;
474
475 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
476 if (!data)
477 return -ENOMEM;
478
479 /* set the device type */
480 data->client = client;
481 data->config = &sq522xx_config[chip];
482 mutex_init(&data->config_lock);
483
484 if (of_property_read_u32(dev->of_node, "shunt-resistor", &val) < 0)
485 val = SQ522XX_RSHUNT_DEFAULT;
486
487
488 if (val <= 0 || val > data->config->calibration_factor)
489 return -ENODEV;
490
491 data->rshunt = val;
492
> 493 sq522xx_regmap_config.max_register = data->config->registers;
494
495 data->regmap = devm_regmap_init_i2c(client, &sq522xx_regmap_config);
496 if (IS_ERR(data->regmap)) {
497 dev_err(dev, "failed to allocate register map\n");
498 return PTR_ERR(data->regmap);
499 }
500
501
502 ret = sq522xx_init(data);
503 if (ret < 0) {
504 dev_err(dev, "error configuring the device: %d\n", ret);
505 return -ENODEV;
506 }
507 if (chip == sq52205) {
508 ret = sq52205_init(data);
509 if (ret < 0) {
510 dev_err(dev, "error configuring the device cal: %d\n", ret);
511 return -ENODEV;
512 }
513 }
514
515 data->groups[group++] = &sq522xx_group;
516 if (chip == sq52205)
517 data->groups[group++] = &sq52205_group;
518
519 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
520 data, data->groups);
521 if (IS_ERR(hwmon_dev))
522 return PTR_ERR(hwmon_dev);
523
524 dev_info(dev, "power monitor %s (Rshunt = %li uOhm)\n",
525 client->name, data->rshunt);
526
527 return 0;
528 }
529

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