hwmon: scmi: Driver improvements and fixes
Subsystems (2)
v2 cover hwmon: scmi: Driver improvements and fixes
This patch series introduces several improvements to the SCMI HWMON driver:
1. Better handling of unsupported sensor types with debug logging
2. Fixes redundant resource management in thermal registration
3. Enhanced error reporting using dev_err_probe()
The changes maintain backward compatibility while improving:
- Debugging capabilities
- Error reporting clarity
- Code maintenance
ChangeLog:
v1:
https://lore.kernel.org/linux-hwmon/[email protected]/
v2:
* fix wrong cover letter and patches count in subjects
Artem Shimko (3):
hwmon: scmi: Add default case with debug output
hwmon: scmi: Remove redundant devm_kfree call
hwmon: scmi: Enhance error reporting with dev_err_probe
drivers/hwmon/scmi-hwmon.c | 45 +++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 1/3 hwmon: scmi: Add default case with debug output
From: Artem Shimko <[email protected]>
Improve handling of unsupported sensor types:
- Add default case in sensor type switch statement
- Log skipped sensors with debug information including:
* Sensor ID
* Sensor type
* Sensor name (if available)
- Use rate-limited dev_dbg for safety
Debug output format:
"Skipping unsupported sensor ID:%d Type:%d (%s)"
--- drivers/hwmon/scmi-hwmon.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hwmon/scmi-hwmon.c +8 -0
@@ -275,6 +275,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) nr_count[type]++;break ; } +default : +dev_dbg (dev,"Skipping unsupported sensor ID:%d Type:%d (%s)\n" , + i, sensor->type, sensor->name ? sensor->name :"unnamed" ); +continue ; }if (nr_count[hwmon_temp])
@@ -323,6 +327,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) idx = --nr_count[type]; *(scmi_sensors->info[type] + idx) = sensor;break ; +default : +dev_dbg (dev,"Skipping unsupported sensor ID:%d Type:%d (%s)\n" , + i, sensor->type, sensor->name ? sensor->name :"unnamed" ); +continue ; } }
Signature · 1 line
2.43.0
Guenter Roeck
maintainerRe: [PATCH 1/3] hwmon: scmi: Add default case with debug output
Quoted 10 lines · a.shimko
From: Artem Shimko <[email protected]>
Improve handling of unsupported sensor types:
- Add default case in sensor type switch statement
- Log skipped sensors with debug information including:
* Sensor ID
* Sensor type
* Sensor name (if available)
- Use rate-limiteddev_dbgfor safety
The code doesn't actually do that, and it would be pointless and make the message useless.
Quoted 13 lines
Debug output format:
"Skipping unsupported sensor ID:%d Type:%d (%s)"Signed-off-by Artem Shimko <[email protected]>--- drivers/hwmon/scmi-hwmon.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/hwmon/scmi-hwmon.c +0
-0
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 281
Quoted 7 lines
drivers/hwmon/scmi-hwmon.c +4
-0@@ -275,6 +275,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) nr_count[type]++;break ; } +default : +dev_dbg (dev,"Skipping unsupported sensor ID:%d Type:%d (%s)\n" , + i, sensor->type, sensor->name ? sensor->name :"unnamed" ); +continue ;
break;
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 333
Quoted 11 lines
drivers/hwmon/scmi-hwmon.c +4
-0}if (nr_count[hwmon_temp])@@ -323,6 +327,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) idx = --nr_count[type]; *(scmi_sensors->info[type] + idx) = sensor;break ; +default : +dev_dbg (dev,"Skipping unsupported sensor ID:%d Type:%d (%s)\n" , + i, sensor->type, sensor->name ? sensor->name :"unnamed" ); +continue ;
break;
Quoted 3 lines
drivers/hwmon/scmi-hwmon.c +0
-0} }
kernel test robot
build botRe: [PATCH 1/3] hwmon: scmi: Add default case with debug output
In reply to a.shimkokernel test robot noticed the following build errors:
Hi a.shimko,
kernel test robot noticed the following build errors:
[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on linus/master v6.16 next-20250806] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/a-shimko/hwmon-scmi-Add-default-case-with-debug-output/20250806-122638 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next patch link: https://lore.kernel.org/r/20250805125003.12573-2-artyom.shimko%40gmail.com patch subject: [PATCH 1/3] hwmon: scmi: Add default case with debug output config: arc-randconfig-001-20250806 (https://download.01.org/0day-ci/archive/20250806/[email protected]/config) compiler: arc-linux-gcc (GCC) 12.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250806/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/hwmon/scmi-hwmon.c: In function 'scmi_hwmon_probe':
>> drivers/hwmon/scmi-hwmon.c:278:17: error: 'default' label not within a switch statement
278 | default:
| ^~~~~~~vim +/default +278 drivers/hwmon/scmi-hwmon.c
228
229 static int scmi_hwmon_probe(struct scmi_device *sdev)
230 {
231 int i, idx;
232 u16 nr_sensors;
233 enum hwmon_sensor_types type;
234 struct scmi_sensors *scmi_sensors;
235 const struct scmi_sensor_info *sensor;
236 int nr_count[hwmon_max] = {0}, nr_types = 0, nr_count_temp = 0;
237 const struct hwmon_chip_info *chip_info;
238 struct device *hwdev, *dev = &sdev->dev;
239 struct hwmon_channel_info *scmi_hwmon_chan;
240 const struct hwmon_channel_info **ptr_scmi_ci;
241 const struct scmi_handle *handle = sdev->handle;
242 struct scmi_protocol_handle *ph;
243
244 if (!handle)
245 return -ENODEV;
246
247 sensor_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_SENSOR, &ph);
248 if (IS_ERR(sensor_ops))
249 return PTR_ERR(sensor_ops);
250
251 nr_sensors = sensor_ops->count_get(ph);
252 if (!nr_sensors)
253 return -EIO;
254
255 scmi_sensors = devm_kzalloc(dev, sizeof(*scmi_sensors), GFP_KERNEL);
256 if (!scmi_sensors)
257 return -ENOMEM;
258
259 scmi_sensors->ph = ph;
260
261 for (i = 0; i < nr_sensors; i++) {
262 sensor = sensor_ops->info_get(ph, i);
263 if (!sensor)
264 return -EINVAL;
265
266 switch (sensor->type) {
267 case TEMPERATURE_C:
268 case VOLTAGE:
269 case CURRENT:
270 case POWER:
271 case ENERGY:
272 type = scmi_types[sensor->type];
273 if (!nr_count[type])
274 nr_types++;
275 nr_count[type]++;
276 break;
277 }
> 278 default:
279 dev_dbg(dev, "Skipping unsupported sensor ID:%d Type:%d (%s)\n",
280 i, sensor->type, sensor->name ? sensor->name : "unnamed");
281 continue;
282 }
283
284 if (nr_count[hwmon_temp])
285 nr_count_temp = nr_count[hwmon_temp];
286
287 scmi_hwmon_chan = devm_kcalloc(dev, nr_types, sizeof(*scmi_hwmon_chan),
288 GFP_KERNEL);
289 if (!scmi_hwmon_chan)
290 return -ENOMEM;
291
292 ptr_scmi_ci = devm_kcalloc(dev, nr_types + 1, sizeof(*ptr_scmi_ci),
293 GFP_KERNEL);
294 if (!ptr_scmi_ci)
295 return -ENOMEM;
296
297 scmi_chip_info.info = ptr_scmi_ci;
298 chip_info = &scmi_chip_info;
299
300 for (type = 0; type < hwmon_max; type++) {
301 if (!nr_count[type])
302 continue;
303
304 scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type],
305 type, hwmon_attributes[type]);
306 *ptr_scmi_ci++ = scmi_hwmon_chan++;
307
308 scmi_sensors->info[type] =
309 devm_kcalloc(dev, nr_count[type],
310 sizeof(*scmi_sensors->info), GFP_KERNEL);
311 if (!scmi_sensors->info[type])
312 return -ENOMEM;
313 }
314
315 for (i = nr_sensors - 1; i >= 0 ; i--) {
316 sensor = sensor_ops->info_get(ph, i);
317 if (!sensor)
318 continue;
319
320 switch (sensor->type) {
321 case TEMPERATURE_C:
322 case VOLTAGE:
323 case CURRENT:
324 case POWER:
325 case ENERGY:
326 type = scmi_types[sensor->type];
327 idx = --nr_count[type];
328 *(scmi_sensors->info[type] + idx) = sensor;
329 break;
330 default:
331 dev_dbg(dev, "Skipping unsupported sensor ID:%d Type:%d (%s)\n",
332 i, sensor->type, sensor->name ? sensor->name : "unnamed");
333 continue;
334 }
335 }
336
337 hwdev = devm_hwmon_device_register_with_info(dev, "scmi_sensors",
338 scmi_sensors, chip_info,
339 NULL);
340 if (IS_ERR(hwdev))
341 return PTR_ERR(hwdev);
342
343 for (i = 0; i < nr_count_temp; i++) {
344 int ret;
345
346 sensor = *(scmi_sensors->info[hwmon_temp] + i);
347 if (!sensor)
348 continue;
349
350 /*
351 * Warn on any misconfiguration related to thermal zones but
352 * bail out of probing only on memory errors.
353 */
354 ret = scmi_thermal_sensor_register(dev, ph, sensor);
355 if (ret) {
356 if (ret == -ENOMEM)
357 return ret;
358 dev_warn(dev,
359 "Thermal zone misconfigured for %s. err=%d\n",
360 sensor->name, ret);
361 }
362 }
363
364 return 0;
365 }
366
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v2 2/3 hwmon: scmi: Remove redundant devm_kfree call
In reply to a.shimkoFrom: Artem Shimko <[email protected]>
Fix potential resource management issue by:
- Removing unnecessary devm_kfree() call in error path
- Relying on devres automatic cleanup
- Preserving all error handling logic
Rationale:
- Memory was allocated with devm_kzalloc()
- devm_ thermal registration manages its own resources
- Double-free could occur during probe failure
--- drivers/hwmon/scmi-hwmon.c | 2 -- 1 file changed, 2 deletions(-)
drivers/hwmon/scmi-hwmon.c +0 -2
@@ -211,8 +211,6 @@ static int scmi_thermal_sensor_register(struct device *dev, tzd =devm_thermal_of_zone_register (dev, th_sensor->info->id, th_sensor, &scmi_hwmon_thermal_ops);if (IS_ERR (tzd)) { -devm_kfree (dev, th_sensor); -if (PTR_ERR (tzd) != -ENODEV )return PTR_ERR (tzd);
Signature · 1 line
2.43.0
Guenter Roeck
maintainerRe: [PATCH 2/3] hwmon: scmi: Remove redundant devm_kfree call
Quoted 11 lines · a.shimko
From: Artem Shimko <[email protected]>
Fix potential resource management issue by:
- Removing unnecessarydevm_kfree()call in error path
- Relying on devres automatic cleanup
- Preserving all error handling logicRationale:
- Memory was allocated withdevm_kzalloc()
-devm_thermal registration manages its own resources
- Double-free could occur during probe failure
The reason for calling devm_kfree() is to avoid holding the memory unnecessarily until the driver deregisters. There is no double free since the code calls devm_kfree(), not kfree().
The reasoning is wrong, and the patch does not add value.
Guenter
Quoted 19 lines
Signed-off-by Artem Shimko <[email protected]>--- drivers/hwmon/scmi-hwmon.c | 2 -- 1 file changed, 2 deletions(-)drivers/hwmon/scmi-hwmon.c +0
-2@@ -211,8 +211,6 @@ static int scmi_thermal_sensor_register(struct device *dev, tzd =devm_thermal_of_zone_register (dev, th_sensor->info->id, th_sensor, &scmi_hwmon_thermal_ops);if (IS_ERR (tzd)) { -devm_kfree (dev, th_sensor); -if (PTR_ERR (tzd) != -ENODEV )return PTR_ERR (tzd);
PATCH v2 3/3 hwmon: scmi: Enhance error reporting with dev_err_probe
In reply to a.shimkoFrom: Artem Shimko <[email protected]>
Replace error returns with dev_err_probe() throughout driver:
- Add descriptive error messages for all failure cases
- Include relevant context (sensor IDs, types etc)
- Standardize error reporting format
Improved messages include:
- "No valid sensor info for index %d"
- "Failed to allocate channel info array"
- "SCMI protocol ops not initialized"
--- drivers/hwmon/scmi-hwmon.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)
drivers/hwmon/scmi-hwmon.c +24 -11
@@ -240,26 +240,36 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)struct scmi_protocol_handle *ph;if (!handle) -return -ENODEV ; +return dev_err_probe (dev, -ENODEV ,"SCMI device handle is NULL\n" ); sensor_ops = handle->devm_protocol_get (sdev,SCMI_PROTOCOL_SENSOR , &ph); -if (IS_ERR (sensor_ops)) -return PTR_ERR (sensor_ops); +if (IS_ERR_OR_NULL (sensor_ops)) { +if (IS_ERR (sensor_ops)) +return dev_err_probe (dev,PTR_ERR (sensor_ops), +"SCMI sensor protocol acquisition failed\n" ); +return dev_err_probe (dev, -EPROTO , +"SCMI sensor protocol ops structure unexpectedly NULL\n" ); + } + +if (!sensor_ops->info_get || !sensor_ops->count_get) +return dev_err_probe (dev, -ENOENT , +"SCMI sensor protocol operations are not initialized\n" ); nr_sensors = sensor_ops->count_get (ph);if (!nr_sensors) -return -EIO ; +return dev_err_probe (dev, -EIO ,"No sensors found\n" ); scmi_sensors =devm_kzalloc (dev,sizeof (*scmi_sensors),GFP_KERNEL );if (!scmi_sensors) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM ,"Failed to allocate scmi_sensors structure\n" ); scmi_sensors->ph = ph;for (i =0 ; i < nr_sensors; i++) { sensor = sensor_ops->info_get (ph, i);if (!sensor) -return -EINVAL ; +return dev_err_probe (dev, -EINVAL , +"Failed to get sensor info for sensor %d\n" , i);switch (sensor->type) {case TEMPERATURE_C :
@@ -285,12 +295,12 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) scmi_hwmon_chan =devm_kcalloc (dev, nr_types,sizeof (*scmi_hwmon_chan),GFP_KERNEL );if (!scmi_hwmon_chan) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM ,"Failed to allocate channel info array\n" ); ptr_scmi_ci =devm_kcalloc (dev, nr_types +1 ,sizeof (*ptr_scmi_ci),GFP_KERNEL );if (!ptr_scmi_ci) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM ,"Failed to allocate channel info pointers\n" ); scmi_chip_info.info = ptr_scmi_ci; chip_info = &scmi_chip_info;
@@ -307,7 +317,8 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)devm_kcalloc (dev, nr_count[type],sizeof (*scmi_sensors->info),GFP_KERNEL );if (!scmi_sensors->info[type]) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM , +"Failed to allocate sensor info for type %d\n" , type); }for (i = nr_sensors -1 ; i >=0 ; i--) {
@@ -336,7 +347,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) scmi_sensors, chip_info, NULL);if (IS_ERR (hwdev)) -return PTR_ERR (hwdev); +return dev_err_probe (dev,PTR_ERR (hwdev),"Failed to register hwmon device\n" );for (i =0 ; i < nr_count_temp; i++) {int ret;
@@ -352,7 +363,9 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) ret =scmi_thermal_sensor_register (dev, ph, sensor);if (ret) {if (ret == -ENOMEM ) -return ret; +return dev_err_probe (dev, ret, +"Failed to allocate memory for thermal zone\n" ); +dev_warn (dev,"Thermal zone misconfigured for %s. err=%d\n" , sensor->name, ret);
Signature · 1 line
2.43.0
Guenter Roeck
maintainerRe: [PATCH 3/3] hwmon: scmi: Enhance error reporting with dev_err_probe
Quoted 22 lines · a.shimko
From: Artem Shimko <[email protected]>
Replace error returns with
dev_err_probe()throughout driver:
- Add descriptive error messages for all failure cases
- Include relevant context (sensor IDs, types etc)
- Standardize error reporting formatImproved messages include:
- "No valid sensor info for index %d"
- "Failed to allocate channel info array"
- "SCMI protocol ops not initialized"Signed-off-by Artem Shimko <[email protected]>--- drivers/hwmon/scmi-hwmon.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)drivers/hwmon/scmi-hwmon.c +0
-0
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 243
Quoted 5 lines
drivers/hwmon/scmi-hwmon.c +1
-1@@ -240,26 +240,36 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)struct scmi_protocol_handle *ph;if (!handle) -return -ENODEV ; +return dev_err_probe (dev, -ENODEV ,"SCMI device handle is NULL\n" );
-ENODEV is not supposed to log an error message.
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 246
Quoted 5 lines
drivers/hwmon/scmi-hwmon.c +1
-2sensor_ops = handle->devm_protocol_get (sdev,SCMI_PROTOCOL_SENSOR , &ph); -if (IS_ERR (sensor_ops)) -return PTR_ERR (sensor_ops); +if (IS_ERR_OR_NULL (sensor_ops)) {
This never returns NULL, and AFAIS no other driver checks for it. Why add this unnecessary check ?
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 256
Quoted 10 lines
drivers/hwmon/scmi-hwmon.c +10
-0+if (IS_ERR (sensor_ops)) +return dev_err_probe (dev,PTR_ERR (sensor_ops), +"SCMI sensor protocol acquisition failed\n" ); +return dev_err_probe (dev, -EPROTO , +"SCMI sensor protocol ops structure unexpectedly NULL\n" ); + } + +if (!sensor_ops->info_get || !sensor_ops->count_get) +return dev_err_probe (dev, -ENOENT , +"SCMI sensor protocol operations are not initialized\n" );
It is not this driver's responsibility to validate sensor_ops.
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 264
Quoted 10 lines
drivers/hwmon/scmi-hwmon.c +2
-2nr_sensors = sensor_ops->count_get (ph);if (!nr_sensors) -return -EIO ; +return dev_err_probe (dev, -EIO ,"No sensors found\n" ); scmi_sensors =devm_kzalloc (dev,sizeof (*scmi_sensors),GFP_KERNEL );if (!scmi_sensors) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM ,"Failed to allocate scmi_sensors structure\n" );
-ENOMEM is not supposed to log an error message.
Quoted 13 lines
drivers/hwmon/scmi-hwmon.c +2
-1scmi_sensors->ph = ph;for (i =0 ; i < nr_sensors; i++) { sensor = sensor_ops->info_get (ph, i);if (!sensor) -return -EINVAL ; +return dev_err_probe (dev, -EINVAL , +"Failed to get sensor info for sensor %d\n" , i);switch (sensor->type) {case TEMPERATURE_C :
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 298
Quoted 5 lines
drivers/hwmon/scmi-hwmon.c +1
-1@@ -285,12 +295,12 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) scmi_hwmon_chan =devm_kcalloc (dev, nr_types,sizeof (*scmi_hwmon_chan),GFP_KERNEL );if (!scmi_hwmon_chan) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM ,"Failed to allocate channel info array\n" );
Same as above.
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 303
Quoted 6 lines
drivers/hwmon/scmi-hwmon.c +1
-1ptr_scmi_ci =devm_kcalloc (dev, nr_types +1 ,sizeof (*ptr_scmi_ci),GFP_KERNEL );if (!ptr_scmi_ci) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM ,"Failed to allocate channel info pointers\n" );
Same as above.
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 321
Quoted 10 lines
drivers/hwmon/scmi-hwmon.c +2
-1scmi_chip_info.info = ptr_scmi_ci; chip_info = &scmi_chip_info;@@ -307,7 +317,8 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)devm_kcalloc (dev, nr_count[type],sizeof (*scmi_sensors->info),GFP_KERNEL );if (!scmi_sensors->info[type]) -return -ENOMEM ; +return dev_err_probe (dev, -ENOMEM , +"Failed to allocate sensor info for type %d\n" , type);
And again.
Quoted 13 lines
drivers/hwmon/scmi-hwmon.c +1
-1}for (i = nr_sensors -1 ; i >=0 ; i--) {@@ -336,7 +347,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) scmi_sensors, chip_info, NULL);if (IS_ERR (hwdev)) -return PTR_ERR (hwdev); +return dev_err_probe (dev,PTR_ERR (hwdev),"Failed to register hwmon device\n" );for (i =0 ; i < nr_count_temp; i++) {int ret;
drivers/hwmon/scmi-hwmon.c static int scmi_hwmon_probe(struct scmi_device *sdev) · line 368
Quoted 7 lines
drivers/hwmon/scmi-hwmon.c +3
-1@@ -352,7 +363,9 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) ret =scmi_thermal_sensor_register (dev, ph, sensor);if (ret) {if (ret == -ENOMEM ) -return ret; +return dev_err_probe (dev, ret, +"Failed to allocate memory for thermal zone\n" ); +
And again.
Quoted 3 lines
drivers/hwmon/scmi-hwmon.c +0
-0dev_warn (dev,"Thermal zone misconfigured for %s. err=%d\n" , sensor->name, ret);