* [PATCH v2 1/7] iio: Remove redundant probe error messages for HID device drivers
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:33 ` Sanjay Chitroda via B4 Relay
2026-11-27 10:33 ` [PATCH v2 2/7] iio: Remove redundant devm_kmemdup() allocation failure messages Sanjay Chitroda via B4 Relay
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:33 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
devm_hid_sensor_setup_trigger() already logs an error when the request
fails for trigger allocation or registration failure, making the
explicit dev_err() redundant.
Similarly, devm_sensor_hub_register_callback() returns -EINVAL, -ENOMEM
or 0 (success), making the dev_err() in the probe path redundant.
Remove both messages from HID-IIO device drivers.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 8 ++------
drivers/iio/gyro/hid-sensor-gyro-3d.c | 8 ++------
drivers/iio/light/hid-sensor-als.c | 8 ++------
drivers/iio/light/hid-sensor-prox.c | 8 ++------
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 8 ++------
drivers/iio/orientation/hid-sensor-incl-3d.c | 8 ++------
drivers/iio/orientation/hid-sensor-rotation.c | 8 ++------
drivers/iio/position/hid-sensor-custom-intel-hinge.c | 8 ++------
drivers/iio/pressure/hid-sensor-press.c | 8 ++------
9 files changed, 18 insertions(+), 54 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 7ba0228f18b4..51f1ae6b222f 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -377,20 +377,16 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&accel_state->common_attributes);
- if (ret < 0) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret < 0)
return ret;
- }
accel_state->callbacks.send_event = accel_3d_proc_event;
accel_state->callbacks.capture_sample = accel_3d_capture_sample;
accel_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&accel_state->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 66778315e86d..ebf34365819c 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -314,10 +314,8 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&gyro_state->common_attributes);
- if (ret < 0) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret < 0)
return ret;
- }
gyro_state->callbacks.send_event = gyro_3d_proc_event;
gyro_state->callbacks.capture_sample = gyro_3d_capture_sample;
@@ -325,10 +323,8 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_GYRO_3D,
&gyro_state->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index f531f25d1b63..452ac6a9651a 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -413,20 +413,16 @@ static int hid_als_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&als_state->common_attributes);
- if (ret < 0) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret < 0)
return ret;
- }
als_state->callbacks.send_event = als_proc_event;
als_state->callbacks.capture_sample = als_capture_sample;
als_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&als_state->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 355b7b02868c..af4becb2e7dd 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -302,20 +302,16 @@ static int hid_prox_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&prox_state->common_attributes);
- if (ret) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret)
return ret;
- }
prox_state->callbacks.send_event = prox_proc_event;
prox_state->callbacks.capture_sample = prox_capture_sample;
prox_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&prox_state->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 4f4cc441770c..5dd36cfd0ca7 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -499,10 +499,8 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&magn_state->magn_flux_attributes);
- if (ret < 0) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret < 0)
return ret;
- }
magn_state->callbacks.send_event = magn_3d_proc_event;
magn_state->callbacks.capture_sample = magn_3d_capture_sample;
@@ -510,10 +508,8 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_COMPASS_3D,
&magn_state->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index b5f70732d035..4570a698cf0e 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -346,10 +346,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&incl_state->common_attributes);
- if (ret) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret)
return ret;
- }
incl_state->callbacks.send_event = incl_3d_proc_event;
incl_state->callbacks.capture_sample = incl_3d_capture_sample;
@@ -357,10 +355,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_INCLINOMETER_3D,
&incl_state->callbacks);
- if (ret) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
index f97c278f16cb..d74fee4b56c8 100644
--- a/drivers/iio/orientation/hid-sensor-rotation.c
+++ b/drivers/iio/orientation/hid-sensor-rotation.c
@@ -359,20 +359,16 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&rot_state->common_attributes);
- if (ret) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret)
return ret;
- }
rot_state->callbacks.send_event = dev_rot_proc_event;
rot_state->callbacks.capture_sample = dev_rot_capture_sample;
rot_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&rot_state->callbacks);
- if (ret) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 101d84b533c9..0b5e3f71e962 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -313,19 +313,15 @@ static int hid_hinge_probe(struct platform_device *pdev)
atomic_set(&st->common_attributes.data_ready, 0);
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, indio_dev->name,
&st->common_attributes);
- if (ret < 0) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret < 0)
return ret;
- }
st->callbacks.send_event = hinge_proc_event;
st->callbacks.capture_sample = hinge_capture_sample;
st->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, &st->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 8ebb8f54a0cb..b081990ffc03 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -281,10 +281,8 @@ static int hid_press_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&press_state->common_attributes);
- if (ret) {
- dev_err(&pdev->dev, "trigger setup failed\n");
+ if (ret)
return ret;
- }
press_state->callbacks.send_event = press_proc_event;
press_state->callbacks.capture_sample = press_capture_sample;
@@ -292,10 +290,8 @@ static int hid_press_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_PRESSURE,
&press_state->callbacks);
- if (ret < 0) {
- dev_err(&pdev->dev, "callback reg failed\n");
+ if (ret < 0)
return ret;
- }
return devm_iio_device_register(dev, indio_dev);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 2/7] iio: Remove redundant devm_kmemdup() allocation failure messages
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
2026-11-27 10:33 ` [PATCH v2 1/7] iio: Remove redundant probe error messages for HID device drivers Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:33 ` Sanjay Chitroda via B4 Relay
2026-11-27 10:33 ` [PATCH v2 3/7] iio: magnetometer: hid-sensor-magn-3d: drop redundant probe error messages Sanjay Chitroda via B4 Relay
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:33 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Several HID IIO drivers print a dev_err() message before returning
-ENOMEM when devm_kmemdup() fails.
The failure is already conveyed by the returned error code and the log
messages do not provide additional debugging information. Remove the
redundant messages to reduce log noise.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 7 +++----
drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 +---
drivers/iio/orientation/hid-sensor-incl-3d.c | 4 +---
drivers/iio/pressure/hid-sensor-press.c | 4 +---
4 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 51f1ae6b222f..f9e04ed2a7cd 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -354,13 +354,12 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to setup common attributes\n");
return ret;
}
+
indio_dev->channels = devm_kmemdup(&pdev->dev, channel_spec,
channel_size, GFP_KERNEL);
-
- if (!indio_dev->channels) {
- dev_err(&pdev->dev, "failed to duplicate channels\n");
+ if (!indio_dev->channels)
return -ENOMEM;
- }
+
ret = accel_3d_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
hsdev->usage, accel_state);
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index ebf34365819c..a785a9fc7f9d 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -292,10 +292,8 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
indio_dev->channels = devm_kmemdup(&pdev->dev, gyro_3d_channels,
sizeof(gyro_3d_channels), GFP_KERNEL);
- if (!indio_dev->channels) {
- dev_err(&pdev->dev, "failed to duplicate channels\n");
+ if (!indio_dev->channels)
return -ENOMEM;
- }
ret = gyro_3d_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 4570a698cf0e..2aed92c3526d 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -323,10 +323,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
indio_dev->channels = devm_kmemdup(&pdev->dev, incl_3d_channels,
sizeof(incl_3d_channels), GFP_KERNEL);
- if (!indio_dev->channels) {
- dev_err(&pdev->dev, "failed to duplicate channels\n");
+ if (!indio_dev->channels)
return -ENOMEM;
- }
ret = incl_3d_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index b081990ffc03..9506284bb798 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -258,10 +258,8 @@ static int hid_press_probe(struct platform_device *pdev)
indio_dev->channels = devm_kmemdup(&pdev->dev, press_channels,
sizeof(press_channels), GFP_KERNEL);
- if (!indio_dev->channels) {
- dev_err(&pdev->dev, "failed to duplicate channels\n");
+ if (!indio_dev->channels)
return -ENOMEM;
- }
ret = press_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 3/7] iio: magnetometer: hid-sensor-magn-3d: drop redundant probe error messages
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
2026-11-27 10:33 ` [PATCH v2 1/7] iio: Remove redundant probe error messages for HID device drivers Sanjay Chitroda via B4 Relay
2026-11-27 10:33 ` [PATCH v2 2/7] iio: Remove redundant devm_kmemdup() allocation failure messages Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:33 ` Sanjay Chitroda via B4 Relay
2026-11-27 11:09 ` Andy Shevchenko
2026-11-27 10:33 ` [PATCH v2 4/7] iio: Use dev_err_probe() in HID IIO device drivers Sanjay Chitroda via B4 Relay
` (4 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:33 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
The probe path emits error messages for conditions where the failure is
either already conveyed by the returned error code or can be identified
from the existing debug messages in the magn_3d_parse_report().
Remove the redundant error messages to reduce log noise and simplify the
error handling code.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 5dd36cfd0ca7..04e2569d7ea8 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -356,11 +356,8 @@ static int magn_3d_parse_report(struct platform_device *pdev,
attr_count++;
}
- if (attr_count <= 0) {
- dev_err(&pdev->dev,
- "failed to find any supported usage attributes in report\n");
+ if (attr_count <= 0)
return -EINVAL;
- }
dev_dbg(&pdev->dev, "magn_3d Found %d usage attributes\n", attr_count);
dev_dbg(&pdev->dev, "magn_3d X: %x:%x Y: %x:%x Z: %x:%x\n",
@@ -372,20 +369,14 @@ static int magn_3d_parse_report(struct platform_device *pdev,
/* Setup IIO channel array */
_channels = devm_kzalloc_objs(&pdev->dev, struct iio_chan_spec,
attr_count);
- if (!_channels) {
- dev_err(&pdev->dev,
- "failed to allocate space for iio channels\n");
+ if (!_channels)
return -ENOMEM;
- }
/* attr_count include timestamp channel, and the iio_vals should be aligned to 8byte */
st->iio_vals = devm_kzalloc_objs(&pdev->dev, u32,
((attr_count + 1) % 2 + (attr_count + 1) / 2) * 2);
- if (!st->iio_vals) {
- dev_err(&pdev->dev,
- "failed to allocate space for iio values array\n");
+ if (!st->iio_vals)
return -ENOMEM;
- }
for (i = 0, *chan_count = 0;
i < MAGN_3D_CHANNEL_MAX && *chan_count < attr_count;
@@ -409,11 +400,8 @@ static int magn_3d_parse_report(struct platform_device *pdev,
}
}
- if (*chan_count <= 0) {
- dev_err(&pdev->dev,
- "failed to find any magnetic channels setup\n");
+ if (*chan_count <= 0)
return -EINVAL;
- }
*channels = _channels;
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 3/7] iio: magnetometer: hid-sensor-magn-3d: drop redundant probe error messages
2026-11-27 10:33 ` [PATCH v2 3/7] iio: magnetometer: hid-sensor-magn-3d: drop redundant probe error messages Sanjay Chitroda via B4 Relay
@ 2026-11-27 11:09 ` Andy Shevchenko
0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-11-27 11:09 UTC (permalink / raw)
To: sanjayembeddedse
Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
linux-kernel
On Fri, Nov 27, 2026 at 04:03:58PM +0530, Sanjay Chitroda via B4 Relay wrote:
>
> The probe path emits error messages for conditions where the failure is
> either already conveyed by the returned error code or can be identified
> from the existing debug messages in the magn_3d_parse_report().
>
> Remove the redundant error messages to reduce log noise and simplify the
> error handling code.
...
> - if (attr_count <= 0) {
> - dev_err(&pdev->dev,
> - "failed to find any supported usage attributes in report\n");
> + if (attr_count <= 0)
> return -EINVAL;
> - }
What is the meaning of attr_count < 0 value? Does it hold the error code already?
...
> static int magn_3d_parse_report(struct platform_device *pdev,
> - if (*chan_count <= 0) {
> - dev_err(&pdev->dev,
> - "failed to find any magnetic channels setup\n");
> + if (*chan_count <= 0)
> return -EINVAL;
> - }
Same question here.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 4/7] iio: Use dev_err_probe() in HID IIO device drivers
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
` (2 preceding siblings ...)
2026-11-27 10:33 ` [PATCH v2 3/7] iio: magnetometer: hid-sensor-magn-3d: drop redundant probe error messages Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:33 ` Sanjay Chitroda via B4 Relay
2026-11-27 10:34 ` [PATCH v2 5/7] iio: add probe error messages to hid humidity and temperature drivers Sanjay Chitroda via B4 Relay
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:33 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Use dev_err_probe() in probe paths to simplify error handling and
properly handle deferred probe errors, avoiding unnecessary log
messages.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 12 ++++--------
drivers/iio/gyro/hid-sensor-gyro-3d.c | 12 ++++--------
drivers/iio/light/hid-sensor-als.c | 12 ++++--------
drivers/iio/light/hid-sensor-prox.c | 12 ++++--------
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 13 +++++--------
drivers/iio/orientation/hid-sensor-incl-3d.c | 12 ++++--------
drivers/iio/orientation/hid-sensor-rotation.c | 12 ++++--------
drivers/iio/position/hid-sensor-custom-intel-hinge.c | 12 ++++--------
drivers/iio/pressure/hid-sensor-press.c | 12 ++++--------
9 files changed, 37 insertions(+), 72 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index f9e04ed2a7cd..414d62d2249f 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -350,10 +350,8 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
&accel_state->common_attributes,
accel_3d_sensitivity_addresses,
ARRAY_SIZE(accel_3d_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
indio_dev->channels = devm_kmemdup(&pdev->dev, channel_spec,
channel_size, GFP_KERNEL);
@@ -363,10 +361,8 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
ret = accel_3d_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
hsdev->usage, accel_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->info = &accel_3d_info;
indio_dev->name = name;
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index a785a9fc7f9d..cc81ac2ccdd1 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -285,10 +285,8 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
&gyro_state->common_attributes,
gyro_3d_sensitivity_addresses,
ARRAY_SIZE(gyro_3d_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
indio_dev->channels = devm_kmemdup(&pdev->dev, gyro_3d_channels,
sizeof(gyro_3d_channels), GFP_KERNEL);
@@ -298,10 +296,8 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
ret = gyro_3d_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
HID_USAGE_SENSOR_GYRO_3D, gyro_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->num_channels = ARRAY_SIZE(gyro_3d_channels);
indio_dev->info = &gyro_3d_info;
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 452ac6a9651a..ef864a2ba4b6 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -383,18 +383,14 @@ static int hid_als_probe(struct platform_device *pdev)
&als_state->common_attributes,
als_sensitivity_addresses,
ARRAY_SIZE(als_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
ret = als_parse_report(pdev, hsdev,
hsdev->usage,
als_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
/* Add timestamp channel */
als_state->channels[als_state->num_channels] = als_channels[CHANNEL_SCAN_INDEX_TIMESTAMP];
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index af4becb2e7dd..4d0c7dffc252 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -280,16 +280,12 @@ static int hid_prox_probe(struct platform_device *pdev)
&prox_state->common_attributes,
prox_sensitivity_addresses,
ARRAY_SIZE(prox_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
ret = prox_parse_report(pdev, hsdev, prox_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->num_channels = prox_state->num_channels;
indio_dev->channels = prox_state->channels;
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 04e2569d7ea8..3a8fbe1655dd 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -461,10 +461,9 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
&magn_state->magn_flux_attributes,
magn_3d_sensitivity_addresses,
ARRAY_SIZE(magn_3d_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
+
magn_state->rot_attributes = magn_state->magn_flux_attributes;
/* sensitivity of rot_attribute is not the same as magn_flux_attributes */
magn_state->rot_attributes.sensitivity.index = -1;
@@ -472,10 +471,8 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
ret = magn_3d_parse_report(pdev, hsdev,
&channels, &chan_count,
HID_USAGE_SENSOR_COMPASS_3D, magn_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to parse report\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->channels = channels;
indio_dev->num_channels = chan_count;
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 2aed92c3526d..8ef3645d9b18 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -316,10 +316,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
&incl_state->common_attributes,
incl_3d_sensitivity_addresses,
ARRAY_SIZE(incl_3d_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
indio_dev->channels = devm_kmemdup(&pdev->dev, incl_3d_channels,
sizeof(incl_3d_channels), GFP_KERNEL);
@@ -330,10 +328,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
(struct iio_chan_spec *)indio_dev->channels,
HID_USAGE_SENSOR_INCLINOMETER_3D,
incl_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->num_channels = ARRAY_SIZE(incl_3d_channels);
indio_dev->info = &incl_3d_info;
diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
index d74fee4b56c8..269ae2e6c095 100644
--- a/drivers/iio/orientation/hid-sensor-rotation.c
+++ b/drivers/iio/orientation/hid-sensor-rotation.c
@@ -338,16 +338,12 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
&rot_state->common_attributes,
rotation_sensitivity_addresses,
ARRAY_SIZE(rotation_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
ret = dev_rot_parse_report(pdev, hsdev, hsdev->usage, rot_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->channels = dev_rot_channels;
indio_dev->num_channels = ARRAY_SIZE(dev_rot_channels);
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 0b5e3f71e962..4c59d8a0e7cd 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -287,10 +287,8 @@ static int hid_hinge_probe(struct platform_device *pdev)
&st->common_attributes,
hinge_sensitivity_addresses,
ARRAY_SIZE(hinge_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
indio_dev->num_channels = ARRAY_SIZE(hinge_channels);
indio_dev->channels = devm_kmemdup(&pdev->dev, hinge_channels,
@@ -301,10 +299,8 @@ static int hid_hinge_probe(struct platform_device *pdev)
ret = hinge_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
hsdev->usage, st);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->info = &hinge_info;
indio_dev->name = "hinge";
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 9506284bb798..2d098ed35ff6 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -251,10 +251,8 @@ static int hid_press_probe(struct platform_device *pdev)
&press_state->common_attributes,
press_sensitivity_addresses,
ARRAY_SIZE(press_sensitivity_addresses));
- if (ret) {
- dev_err(&pdev->dev, "failed to setup common attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup common attributes\n");
indio_dev->channels = devm_kmemdup(&pdev->dev, press_channels,
sizeof(press_channels), GFP_KERNEL);
@@ -264,10 +262,8 @@ static int hid_press_probe(struct platform_device *pdev)
ret = press_parse_report(pdev, hsdev,
(struct iio_chan_spec *)indio_dev->channels,
HID_USAGE_SENSOR_PRESSURE, press_state);
- if (ret) {
- dev_err(&pdev->dev, "failed to setup attributes\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to setup attributes\n");
indio_dev->num_channels =
ARRAY_SIZE(press_channels);
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 5/7] iio: add probe error messages to hid humidity and temperature drivers
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
` (3 preceding siblings ...)
2026-11-27 10:33 ` [PATCH v2 4/7] iio: Use dev_err_probe() in HID IIO device drivers Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:34 ` Sanjay Chitroda via B4 Relay
2026-11-27 10:34 ` [PATCH v2 6/7] iio: Simplify trigger setup error checks Sanjay Chitroda via B4 Relay
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:34 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 6/7] iio: Simplify trigger setup error checks
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
` (4 preceding siblings ...)
2026-11-27 10:34 ` [PATCH v2 5/7] iio: add probe error messages to hid humidity and temperature drivers Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:34 ` Sanjay Chitroda via B4 Relay
2026-11-27 10:34 ` [PATCH v2 7/7] iio: Simplify callback registration " Sanjay Chitroda via B4 Relay
2026-11-27 11:11 ` [PATCH v2 0/7] HID: iio: Unify probe-path logging Andy Shevchenko
7 siblings, 0 replies; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:34 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda,
Joshua Crofts
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
devm_hid_sensor_setup_trigger() returns 0 on success and a
negative error code on failure. Replace open-coded error checks
using:
if (ret < 0)
with:
if (ret)
across HID sensor drivers using the helper.
This simplifies the code and aligns it with common kernel
error-handling style without changing behavior.
Suggested-by: Joshua Crofts <crofts@kernel.org>
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 2 +-
drivers/iio/gyro/hid-sensor-gyro-3d.c | 2 +-
drivers/iio/light/hid-sensor-als.c | 2 +-
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 2 +-
drivers/iio/position/hid-sensor-custom-intel-hinge.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 414d62d2249f..d75ee16b8f45 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -372,7 +372,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&accel_state->common_attributes);
- if (ret < 0)
+ if (ret)
return ret;
accel_state->callbacks.send_event = accel_3d_proc_event;
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index cc81ac2ccdd1..d5acb38268af 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -308,7 +308,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&gyro_state->common_attributes);
- if (ret < 0)
+ if (ret)
return ret;
gyro_state->callbacks.send_event = gyro_3d_proc_event;
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index ef864a2ba4b6..9b3c8d8345b9 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -409,7 +409,7 @@ static int hid_als_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&als_state->common_attributes);
- if (ret < 0)
+ if (ret)
return ret;
als_state->callbacks.send_event = als_proc_event;
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 3a8fbe1655dd..c179fcd364b9 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -484,7 +484,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, name,
&magn_state->magn_flux_attributes);
- if (ret < 0)
+ if (ret)
return ret;
magn_state->callbacks.send_event = magn_3d_proc_event;
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 4c59d8a0e7cd..9bc0262b27c4 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -309,7 +309,7 @@ static int hid_hinge_probe(struct platform_device *pdev)
atomic_set(&st->common_attributes.data_ready, 0);
ret = devm_hid_sensor_setup_trigger(dev, indio_dev, indio_dev->name,
&st->common_attributes);
- if (ret < 0)
+ if (ret)
return ret;
st->callbacks.send_event = hinge_proc_event;
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 7/7] iio: Simplify callback registration error checks
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
` (5 preceding siblings ...)
2026-11-27 10:34 ` [PATCH v2 6/7] iio: Simplify trigger setup error checks Sanjay Chitroda via B4 Relay
@ 2026-11-27 10:34 ` Sanjay Chitroda via B4 Relay
2026-11-27 11:11 ` [PATCH v2 0/7] HID: iio: Unify probe-path logging Andy Shevchenko
7 siblings, 0 replies; 10+ messages in thread
From: Sanjay Chitroda via B4 Relay @ 2026-11-27 10:34 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko
Cc: linux-input, linux-iio, linux-kernel, Sanjay Chitroda
From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
devm_sensor_hub_register_callback() returns 0 on success and a
negative error code on failure. Replace open-coded error checks
using:
if (ret < 0)
with:
if (ret)
across HID sensor drivers using the helper.
This simplifies the code and aligns it with common kernel
error-handling style without changing behavior.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 2 +-
drivers/iio/gyro/hid-sensor-gyro-3d.c | 2 +-
drivers/iio/light/hid-sensor-als.c | 2 +-
drivers/iio/light/hid-sensor-prox.c | 2 +-
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 2 +-
drivers/iio/position/hid-sensor-custom-intel-hinge.c | 2 +-
drivers/iio/pressure/hid-sensor-press.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index d75ee16b8f45..386dbbda57d4 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -380,7 +380,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
accel_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&accel_state->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index d5acb38268af..c89e5a7a3222 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -317,7 +317,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_GYRO_3D,
&gyro_state->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 9b3c8d8345b9..a7783b947564 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -417,7 +417,7 @@ static int hid_als_probe(struct platform_device *pdev)
als_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&als_state->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 4d0c7dffc252..b793d7abc0f5 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -306,7 +306,7 @@ static int hid_prox_probe(struct platform_device *pdev)
prox_state->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage,
&prox_state->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index c179fcd364b9..742dc4130e66 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -493,7 +493,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_COMPASS_3D,
&magn_state->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 9bc0262b27c4..4773577dcd57 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -316,7 +316,7 @@ static int hid_hinge_probe(struct platform_device *pdev)
st->callbacks.capture_sample = hinge_capture_sample;
st->callbacks.pdev = pdev;
ret = devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, &st->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 2d098ed35ff6..8b41e1461993 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -284,7 +284,7 @@ static int hid_press_probe(struct platform_device *pdev)
ret = devm_sensor_hub_register_callback(dev, hsdev,
HID_USAGE_SENSOR_PRESSURE,
&press_state->callbacks);
- if (ret < 0)
+ if (ret)
return ret;
return devm_iio_device_register(dev, indio_dev);
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2 0/7] HID: iio: Unify probe-path logging
2026-11-27 10:33 [PATCH v2 0/7] HID: iio: Unify probe-path logging Sanjay Chitroda via B4 Relay
` (6 preceding siblings ...)
2026-11-27 10:34 ` [PATCH v2 7/7] iio: Simplify callback registration " Sanjay Chitroda via B4 Relay
@ 2026-11-27 11:11 ` Andy Shevchenko
7 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-11-27 11:11 UTC (permalink / raw)
To: sanjayembeddedse
Cc: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada, David Lechner,
Nuno Sá, Andy Shevchenko, linux-input, linux-iio,
linux-kernel, Joshua Crofts
On Fri, Nov 27, 2026 at 04:03:55PM +0530, Sanjay Chitroda via B4 Relay wrote:
> This series provides consistent support for logs in probe() path for
> HID IIO drivers with suggestion and input from Jonathan.
>
> This is followup series on top of multiple sub-series submitted for HID
> IIO device drivers which included fixes, devm support, cleanup and using
> preferred kernel coding style. This series adopts a common logging
> approach throughout the HID IIO device drivers in probe path.
> ---
> Changes in v2:
> - Following suggestion of Joshua, remove the comparison and change the
> checks to `if (ret)` as respective devm_*() API `return 0` on success.
> - Link to v1: https://patch.msgid.link/20261105-19-oct-hid-iio-unified-print-framework-v1-0-0b360d9552d9@gmail.com
Reviewed-by: Andy Shevchenko <andy@kernel.org>
for the not commented patches (the one is depends on the answer).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread