From: Jonathan Cameron <jic23@kernel.org>
To: Colin King <colin.king@canonical.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Song Hongyan <hongyan.song@intel.com>,
hock.leong.kweh@intel.com, linux-iio@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: hid-sensor: fix return of -EINVAL on invalid values in ret or value
Date: Wed, 26 Apr 2017 06:32:46 +0000 [thread overview]
Message-ID: <8b33d431-4c3b-fb94-539c-a35cb3a123cc@kernel.org> (raw)
In-Reply-To: <20170419143548.14130-1-colin.king@canonical.com>
On 19/04/17 15:35, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.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,
>
next prev parent reply other threads:[~2017-04-26 6:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 14:35 [PATCH] iio: hid-sensor: fix return of -EINVAL on invalid values in ret or value Colin King
2017-04-26 6:32 ` Jonathan Cameron [this message]
2017-04-26 13:55 ` Srinivas Pandruvada
2017-04-27 6:17 ` 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=8b33d431-4c3b-fb94-539c-a35cb3a123cc@kernel.org \
--to=jic23@kernel.org \
--cc=colin.king@canonical.com \
--cc=hock.leong.kweh@intel.com \
--cc=hongyan.song@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--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