Re: [PATCH v2 1/2] iio: gyro: hid-sensor-gyro-3d: Remove redundant dev_err()
Jonathan Cameron <[email protected]>
| Newsgroups | org.kernel.vger.linux-input,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260727022253.117f21cb@jic23-huawei> |
On Fri, 24 Jul 2026 22:57:20 +0530 Sanjay Chitroda via B4 Relay <[email protected]> wrote: > From: Sanjay Chitroda <[email protected]> > > Respective APIs used during probe setup already emit detailed error > messages or return appropriate standard error codes on failure. > > Remove the redundant/dead driver-specific dev_err() calls to avoid > duplicate error reporting. > > Signed-off-by: Sanjay Chitroda <[email protected]> > --- > drivers/iio/gyro/hid-sensor-gyro-3d.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c > index 58250a972567..bcf53e267701 100644 > --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c > +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c > gyro_state->callbacks.pdev = pdev; > ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D, > &gyro_state->callbacks); > - if (ret < 0) { > - dev_err(&pdev->dev, "callback reg failed\n"); Hmm. Just about on this one returning sufficient error codes. However the caller of this can't differentiate those values from the same values from other calls in this function. > + if (ret < 0) > goto error_remove_trigger; > - } > > ret = iio_device_register(indio_dev); This one I'm more dubious about. There is a lot of work done iio_device_register() and traditionally we haven't been that focused on printing error messages. There are some paths covered but some others are not. I'm not sure it is useful to just return the error code as that matches with other paths that will give similar error codes. Maybe it is worth considering doing an audit of iio_device_register() and making sure that suitable errors are printed in all locations but that will be hard to do and I'm not sure I want to see the churn of ripping out prints on this in every driver because we now think the core is doing enough. I'm definitely open to gathering some more opinions on this though so let us see if others reply to the thread. Jonathan > - if (ret) { > - dev_err(&pdev->dev, "device register failed\n"); > + if (ret) > goto error_remove_callback; > - } > > return ret; > >