[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b33d431-4c3b-fb94-539c-a35cb3a123cc@kernel.org>
Date: Wed, 26 Apr 2017 07:32:46 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Colin King <colin.king@...onical.com>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Song Hongyan <hongyan.song@...el.com>,
hock.leong.kweh@...el.com, linux-iio@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: hid-sensor: fix return of -EINVAL on invalid values
in ret or value
On 19/04/17 15:35, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> Ensure that when an invalid value in ret or value is found -EINVAL
> is returned. A previous commit broke the way the return error is
> being returned and instead caused the return code in ret to be
> re-assigned rather than be returned.
>
> Fixes: 5d9854eaea776 ("iio: hid-sensor: Store restore poll and hysteresis on S3")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
Given the 'fun' we have had with this on recently Srinivas, could you
sanity check what looks like an obviously correct patch?
I'm being overly paranoid for a while ;)
Jonathan
> ---
> drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> index 1c0874cdf665..aeb09a85d7a8 100644
> --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> @@ -230,7 +230,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
> ret = sensor_hub_set_feature(st->hsdev, st->poll.report_id,
> st->poll.index, sizeof(value), &value);
> if (ret < 0 || value < 0)
> - ret = -EINVAL;
> + return -EINVAL;
>
> ret = sensor_hub_get_feature(st->hsdev,
> st->poll.report_id,
> @@ -283,7 +283,7 @@ int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st,
> st->sensitivity.index, sizeof(value),
> &value);
> if (ret < 0 || value < 0)
> - ret = -EINVAL;
> + return -EINVAL;
>
> ret = sensor_hub_get_feature(st->hsdev,
> st->sensitivity.report_id,
>
Powered by blists - more mailing lists