drivers/hwmon/pmbus/ltc4286.c:88 ltc4286_probe() warn: passing zero to 'dev_err_probe'
PATCH 6418/8213 drivers/hwmon/pmbus/ltc4286.c:88 ltc4286_probe() warn: passing zero to 'dev_err_probe'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 17cb8a20bde66a520a2ca7aad1063e1ce7382240 commit: 263835c7e3879a2bfa33fe86711349b30af0b0cd [6418/8213] hwmon: (pmbus) Add ltc4286 driver config: riscv-randconfig-r081-20231216 (https://download.01.org/0day-ci/archive/20231217/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:drivers/hwmon/pmbus/ltc4286.c:88 ltc4286_probe() warn: passing zero to 'dev_err_probe'
vim +/dev_err_probe +88 drivers/hwmon/pmbus/ltc4286.c
263835c7e3879a Delphine CC Chiu 2023-11-23 67 static int ltc4286_probe(struct i2c_client *client)
263835c7e3879a Delphine CC Chiu 2023-11-23 68 {
263835c7e3879a Delphine CC Chiu 2023-11-23 69 int ret;
263835c7e3879a Delphine CC Chiu 2023-11-23 70 const struct i2c_device_id *mid;
263835c7e3879a Delphine CC Chiu 2023-11-23 71 u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
263835c7e3879a Delphine CC Chiu 2023-11-23 72 struct pmbus_driver_info *info;
263835c7e3879a Delphine CC Chiu 2023-11-23 73 u32 rsense;
263835c7e3879a Delphine CC Chiu 2023-11-23 74 int vrange_nval, vrange_oval;
263835c7e3879a Delphine CC Chiu 2023-11-23 75
263835c7e3879a Delphine CC Chiu 2023-11-23 76 ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, block_buffer);
263835c7e3879a Delphine CC Chiu 2023-11-23 77 if (ret < 0) {
263835c7e3879a Delphine CC Chiu 2023-11-23 78 return dev_err_probe(&client->dev, ret,
263835c7e3879a Delphine CC Chiu 2023-11-23 79 "Failed to read manufacturer id\n");
263835c7e3879a Delphine CC Chiu 2023-11-23 80 }
263835c7e3879a Delphine CC Chiu 2023-11-23 81
263835c7e3879a Delphine CC Chiu 2023-11-23 82 /*
263835c7e3879a Delphine CC Chiu 2023-11-23 83 * Refer to ltc4286 datasheet page 20
263835c7e3879a Delphine CC Chiu 2023-11-23 84 * the manufacturer id is LTC
263835c7e3879a Delphine CC Chiu 2023-11-23 85 */
263835c7e3879a Delphine CC Chiu 2023-11-23 86 if (ret != LTC4286_MFR_ID_SIZE ||
263835c7e3879a Delphine CC Chiu 2023-11-23 87 strncmp(block_buffer, "LTC", LTC4286_MFR_ID_SIZE)) {
263835c7e3879a Delphine CC Chiu 2023-11-23 @88 return dev_err_probe(&client->dev, ret,
^^^Use -EINVAL instead of ret.
263835c7e3879a Delphine CC Chiu 2023-11-23 89 "Manufacturer id mismatch\n");
263835c7e3879a Delphine CC Chiu 2023-11-23 90 }
263835c7e3879a Delphine CC Chiu 2023-11-23 91
263835c7e3879a Delphine CC Chiu 2023-11-23 92 ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
263835c7e3879a Delphine CC Chiu 2023-11-23 93 if (ret < 0) {
263835c7e3879a Delphine CC Chiu 2023-11-23 94 return dev_err_probe(&client->dev, ret,
263835c7e3879a Delphine CC Chiu 2023-11-23 95 "Failed to read manufacturer model\n");
263835c7e3879a Delphine CC Chiu 2023-11-23 96 }
263835c7e3879a Delphine CC Chiu 2023-11-23 97
263835c7e3879a Delphine CC Chiu 2023-11-23 98 for (mid = ltc4286_id; mid->name[0]; mid++) {Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 40 lines · Dan Carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 17cb8a20bde66a520a2ca7aad1063e1ce7382240 commit: 263835c7e3879a2bfa33fe86711349b30af0b0cd [6418/8213] hwmon: (pmbus) Add ltc4286 driver config: riscv-randconfig-r081-20231216 (https://download.01.org/0day-ci/archive/20231217/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/smatch warnings:
drivers/hwmon/pmbus/ltc4286.c:88ltc4286_probe()warn: passing zero to 'dev_err_probe'vim +/dev_err_probe +88
drivers/hwmon/pmbus/ltc4286.c263835c7e3879a Delphine CC Chiu 2023-11-23 67 static int ltc4286_probe(struct i2c_client *client) 263835c7e3879a Delphine CC Chiu 2023-11-23 68 { 263835c7e3879a Delphine CC Chiu 2023-11-23 69 int ret; 263835c7e3879a Delphine CC Chiu 2023-11-23 70 const struct i2c_device_id *mid; 263835c7e3879a Delphine CC Chiu 2023-11-23 71 u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1]; 263835c7e3879a Delphine CC Chiu 2023-11-23 72 struct pmbus_driver_info *info; 263835c7e3879a Delphine CC Chiu 2023-11-23 73 u32 rsense; 263835c7e3879a Delphine CC Chiu 2023-11-23 74 int vrange_nval, vrange_oval; 263835c7e3879a Delphine CC Chiu 2023-11-23 75 263835c7e3879a Delphine CC Chiu 2023-11-23 76 ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, block_buffer); 263835c7e3879a Delphine CC Chiu 2023-11-23 77 if (ret < 0) { 263835c7e3879a Delphine CC Chiu 2023-11-23 78 return dev_err_probe(&client->dev, ret, 263835c7e3879a Delphine CC Chiu 2023-11-23 79 "Failed to read manufacturer id\n"); 263835c7e3879a Delphine CC Chiu 2023-11-23 80 } 263835c7e3879a Delphine CC Chiu 2023-11-23 81 263835c7e3879a Delphine CC Chiu 2023-11-23 82 /* 263835c7e3879a Delphine CC Chiu 2023-11-23 83 * Refer to ltc4286 datasheet page 20 263835c7e3879a Delphine CC Chiu 2023-11-23 84 * the manufacturer id is LTC 263835c7e3879a Delphine CC Chiu 2023-11-23 85 */ 263835c7e3879a Delphine CC Chiu 2023-11-23 86 if (ret != LTC4286_MFR_ID_SIZE || 263835c7e3879a Delphine CC Chiu 2023-11-23 87 strncmp(block_buffer, "LTC", LTC4286_MFR_ID_SIZE)) { 263835c7e3879a Delphine CC Chiu 2023-11-23 @88 return dev_err_probe(&client->dev, ret, ^^^
Quoted 2 lines
Use
-EINVALinstead of ret.
I fixed it up, using -ENODEV to match other drivers with the same problem. No need to send a patch.
Thanks,
Guenter
Quoted 15 lines
263835c7e3879a Delphine CC Chiu 2023-11-23 89 "Manufacturer id mismatch\n"); 263835c7e3879a Delphine CC Chiu 2023-11-23 90 } 263835c7e3879a Delphine CC Chiu 2023-11-23 91 263835c7e3879a Delphine CC Chiu 2023-11-23 92 ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer); 263835c7e3879a Delphine CC Chiu 2023-11-23 93 if (ret < 0) { 263835c7e3879a Delphine CC Chiu 2023-11-23 94 return dev_err_probe(&client->dev, ret, 263835c7e3879a Delphine CC Chiu 2023-11-23 95 "Failed to read manufacturer model\n"); 263835c7e3879a Delphine CC Chiu 2023-11-23 96 } 263835c7e3879a Delphine CC Chiu 2023-11-23 97 263835c7e3879a Delphine CC Chiu 2023-11-23 98 for (mid = ltc4286_id; mid->name[0]; mid++) {Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki