[PATCH] hwmon: (pmbus) Expose PEC debugfs attribute

Guenter Roeck linux at roeck-us.net
Thu Sep 10 23:32:10 AEST 2020


On 9/10/20 3:51 AM, Andrew Jeffery wrote:
> 
> 
> On Thu, 10 Sep 2020, at 20:04, Guenter Roeck wrote:
>> On 9/10/20 3:05 AM, Dan Carpenter wrote:
>>> Hi Andrew,
>>>
>>> url:    https://github.com/0day-ci/linux/commits/Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
>>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
>>> config: x86_64-randconfig-m001-20200909 (attached as .config)
>>> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <lkp at intel.com>
>>> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
>>>
>>> smatch warnings:
>>> drivers/hwmon/pmbus/pmbus_core.c:2415 pmbus_debugfs_ops_pec_open() warn: '0x' prefix is confusing together with '%1llu' specifier
>>>
>>> # https://github.com/0day-ci/linux/commit/705b8b5588d4102256d0954086ed16c9bdf9804f
>>> git remote add linux-review https://github.com/0day-ci/linux
>>> git fetch --no-tags linux-review Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
>>> git checkout 705b8b5588d4102256d0954086ed16c9bdf9804f
>>> vim +2415 drivers/hwmon/pmbus/pmbus_core.c
>>>
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2391  static int pmbus_debugfs_set_pec(void *data, u64 val)
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2392  {
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2393  	int rc;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2394  	struct i2c_client *client = data;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2395  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2396  	if (!val) {
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2397  		client->flags &= ~I2C_CLIENT_PEC;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2398  		return 0;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2399  	}
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2400  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2401  	if (val != 1)
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2402  		return -EINVAL;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2403  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2404  	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2405  	if (rc < 0)
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2406  		return rc;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2407  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2408  	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2409  		return -ENOTSUPP;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2410  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2411  	client->flags |= I2C_CLIENT_PEC;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2412  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2413  	return 0;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2414  }
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09 @2415  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2416  			 pmbus_debugfs_set_pec, "0x%1llu\n");
>>>                                                                                                  ^^^^^^^
>>> Was the 1 intentional?  Anyway, you probably want to remove the 0x so
>>> it doesn't look like hex.
>>>
>>
>> Nice catch; I didn't notice the 1. It is still there in v2, but it does 
>> seem quite useless.
> 
> Do you want to just rebase it out, or would you like me to send
> a patch removing the stray 1 from v2?
> 

I'll rebase it.

Thanks,
Guenter



More information about the openbmc mailing list