From: Jonathan Cameron <jic23@kernel.org>
To: Shreeya Patel <shreeya.patel23498@gmail.com>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de,
pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] Staging: iio: adt7316: Add an extra check for 'ret' equals to 0
Date: Sat, 17 Nov 2018 17:00:23 +0000 [thread overview]
Message-ID: <20181117170023.54892898@archlinux> (raw)
In-Reply-To: <20181116225132.24459-1-shreeya.patel23498@gmail.com>
On Sat, 17 Nov 2018 04:21:32 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> wrote:
> ret = 0 indicates a case of no error but no data read from
> the bus which is an invalid case. This case doesn't ever happen
> in reality. It should perhaps be handled for correctness though.
>
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/staging/iio/addac/adt7316-i2c.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c
> index 856bcfa60c6c..473e5e34ec00 100644
> --- a/drivers/staging/iio/addac/adt7316-i2c.c
> +++ b/drivers/staging/iio/addac/adt7316-i2c.c
> @@ -30,6 +30,10 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data)
> }
>
> ret = i2c_smbus_read_byte(client);
> +
> + if (!ret)
> + return -EIO;
> +
> if (ret < 0) {
> dev_err(&cl->dev, "I2C read error\n");
> return ret;
prev parent reply other threads:[~2018-11-18 3:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 22:51 [PATCH 2/7] Staging: iio: adt7316: Add an extra check for 'ret' equals to 0 Shreeya Patel
2018-11-17 17:00 ` Jonathan Cameron [this message]
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=20181117170023.54892898@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.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=shreeya.patel23498@gmail.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;
as well as URLs for NNTP newsgroup(s).