Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: hid-sensors: Fix an error handling path in _hid_sensor_set_report_latency()
Date: Sat, 5 Oct 2024 19:06:20 +0100	[thread overview]
Message-ID: <20241005190620.5f8633a9@jic23-huawei> (raw)
In-Reply-To: <c50640665f091a04086e5092cf50f73f2055107a.1727980825.git.christophe.jaillet@wanadoo.fr>

On Thu,  3 Oct 2024 20:41:12 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> If hid_sensor_set_report_latency() fails, the error code should be returned
> instead of a value likely to be interpreted as 'success'.
> 
> Fixes: 138bc7969c24 ("iio: hid-sensor-hub: Implement batch mode")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative.
> 
> The code just *looks* wrong to me. No strong opinion, if it is done on
> purpose or not.
Agreed it smells :)  But I'd like more eyes on this before I take the fix
as maybe there is something subtle going on.

J
> ---
>  drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> index ad8910e6ad59..abb09fefc792 100644
> --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
> @@ -32,7 +32,7 @@ static ssize_t _hid_sensor_set_report_latency(struct device *dev,
>  	latency = integer * 1000 + fract / 1000;
>  	ret = hid_sensor_set_report_latency(attrb, latency);
>  	if (ret < 0)
> -		return len;
> +		return ret;
>  
>  	attrb->latency_ms = hid_sensor_get_report_latency(attrb);
>  


  reply	other threads:[~2024-10-05 18:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 18:41 [PATCH] iio: hid-sensors: Fix an error handling path in _hid_sensor_set_report_latency() Christophe JAILLET
2024-10-05 18:06 ` Jonathan Cameron [this message]
2024-10-08 17:21   ` srinivas pandruvada
2024-10-10 17:50     ` 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=20241005190620.5f8633a9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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