[PATCH v2 5/7] iio: add probe error messages to hid humidity and temperature drivers
From: Sanjay Chitroda via B4 Relay
Date: Fri Nov 27 2026 - 05:34:53 EST
From: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
hid_sensor_parse_common_attributes() and the driver-specific
*_parse_report() helpers may fail during probe without emitting any
diagnostic information. Add error messages for these failure paths so
that probe failures can be more easily identified from kernel logs,
while preserving the original error codes.
This also improves consistency with other HID IIO drivers that provide
probe-time diagnostics.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
---
drivers/iio/humidity/hid-sensor-humidity.c | 4 ++--
drivers/iio/temperature/hid-sensor-temperature.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
index 95dc4c4726f2..388a7b02fa1d 100644
--- a/drivers/iio/humidity/hid-sensor-humidity.c
+++ b/drivers/iio/humidity/hid-sensor-humidity.c
@@ -210,7 +210,7 @@ static int hid_humidity_probe(struct platform_device *pdev)
humidity_sensitivity_addresses,
ARRAY_SIZE(humidity_sensitivity_addresses));
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
humid_chans = devm_kmemdup(&pdev->dev, humidity_channels,
sizeof(humidity_channels), GFP_KERNEL);
@@ -220,7 +220,7 @@ static int hid_humidity_probe(struct platform_device *pdev)
ret = humidity_parse_report(pdev, hsdev, humid_chans,
HID_USAGE_SENSOR_HUMIDITY, humid_st);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->channels = humid_chans;
indio_dev->num_channels = ARRAY_SIZE(humidity_channels);
diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
index 6c112b444627..ef657c1cb043 100644
--- a/drivers/iio/temperature/hid-sensor-temperature.c
+++ b/drivers/iio/temperature/hid-sensor-temperature.c
@@ -207,7 +207,7 @@ static int hid_temperature_probe(struct platform_device *pdev)
temperature_sensitivity_addresses,
ARRAY_SIZE(temperature_sensitivity_addresses));
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
temp_chans = devm_kmemdup(&pdev->dev, temperature_channels,
sizeof(temperature_channels), GFP_KERNEL);
@@ -217,7 +217,7 @@ static int hid_temperature_probe(struct platform_device *pdev)
ret = temperature_parse_report(pdev, hsdev, temp_chans,
HID_USAGE_SENSOR_TEMPERATURE, temp_st);
if (ret)
- return ret;
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->channels = temp_chans;
indio_dev->num_channels = ARRAY_SIZE(temperature_channels);
--
2.34.1