[PATCH 3/5] iio: magnetometer: hid-sensor-magn-3d: drop redundant probe error messages

From: Sanjay Chitroda via B4 Relay

Date: Thu Nov 05 2026 - 07:42:33 EST


From: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>

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@xxxxxxxxx>
---
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 911b15a5175d..fb9a561706a8 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",
@@ -373,21 +370,15 @@ static int magn_3d_parse_report(struct platform_device *pdev,
_channels = devm_kcalloc(&pdev->dev, attr_count,
sizeof(struct iio_chan_spec),
GFP_KERNEL);
- 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_kcalloc(&pdev->dev,
((attr_count + 1) % 2 + (attr_count + 1) / 2) * 2,
sizeof(u32), GFP_KERNEL);
- 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;
@@ -411,11 +402,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