Linux Input/HID development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sanjay Chitroda via B4 Relay
	<devnull+sanjayembeddedse.gmail.com@kernel.org>
Cc: sanjayembeddedse@gmail.com, "Jiri Kosina" <jikos@kernel.org>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] iio: gyro: hid-sensor-gyro-3d: Remove redundant dev_err()
Date: Mon, 27 Jul 2026 02:22:53 +0100	[thread overview]
Message-ID: <20260727022253.117f21cb@jic23-huawei> (raw)
In-Reply-To: <20260724-24-july-hid-gyro-dev-log-clenaup-v2-1-01671b07b181@gmail.com>

On Fri, 24 Jul 2026 22:57:20 +0530
Sanjay Chitroda via B4 Relay <devnull+sanjayembeddedse.gmail.com@kernel.org> wrote:

> From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
> 
> 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 <sanjayembeddedse@gmail.com>
> ---
>  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;
>  
> 


  reply	other threads:[~2026-07-27  1:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 17:27 [PATCH v2 0/2] HID: iio: gyro: hid-sensor-gyro-3d: probe cleanup Sanjay Chitroda via B4 Relay
2026-07-24 17:27 ` [PATCH v2 1/2] iio: gyro: hid-sensor-gyro-3d: Remove redundant dev_err() Sanjay Chitroda via B4 Relay
2026-07-27  1:22   ` Jonathan Cameron [this message]
2026-07-24 17:27 ` [PATCH v2 2/2] iio: gyro: hid-sensor-gyro-3d: Use dev_err_probe() Sanjay Chitroda via B4 Relay
2026-07-27  1:25   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260727022253.117f21cb@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=devnull+sanjayembeddedse.gmail.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sanjayembeddedse@gmail.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox