From: Jonathan Cameron <jic23@kernel.org>
To: Slawomir Stepien <sst@poczta.fm>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de,
pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
gregkh@linuxfoundation.org
Subject: Re: [PATCH 1/1] staging: iio: adc: ad7280a: handle error from __ad7280_read32()
Date: Sun, 21 Oct 2018 14:17:51 +0100 [thread overview]
Message-ID: <20181021141751.68fa7cb7@archlinux> (raw)
In-Reply-To: <20181020210411.GA7662@x220.localdomain>
On Sat, 20 Oct 2018 23:04:11 +0200
Slawomir Stepien <sst@poczta.fm> wrote:
> Inside __ad7280_read32(), the spi_sync_transfer() can fail with negative
> error code. This change will ensure that this error is being passed up
> in the call stack, so it can be handled.
>
> Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Looks good to me.
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/adc/ad7280a.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index b736275c10f5..6a48ad067a8b 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -256,7 +256,9 @@ static int ad7280_read(struct ad7280_state *st, unsigned int devaddr,
> if (ret)
> return ret;
>
> - __ad7280_read32(st, &tmp);
> + ret = __ad7280_read32(st, &tmp);
> + if (ret)
> + return ret;
>
> if (ad7280_check_crc(st, tmp))
> return -EIO;
> @@ -294,7 +296,9 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned int devaddr,
>
> ad7280_delay(st);
>
> - __ad7280_read32(st, &tmp);
> + ret = __ad7280_read32(st, &tmp);
> + if (ret)
> + return ret;
>
> if (ad7280_check_crc(st, tmp))
> return -EIO;
> @@ -327,7 +331,9 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned int cnt,
> ad7280_delay(st);
>
> for (i = 0; i < cnt; i++) {
> - __ad7280_read32(st, &tmp);
> + ret = __ad7280_read32(st, &tmp);
> + if (ret)
> + return ret;
>
> if (ad7280_check_crc(st, tmp))
> return -EIO;
> @@ -370,7 +376,10 @@ static int ad7280_chain_setup(struct ad7280_state *st)
> return ret;
>
> for (n = 0; n <= AD7280A_MAX_CHAIN; n++) {
> - __ad7280_read32(st, &val);
> + ret = __ad7280_read32(st, &val);
> + if (ret)
> + return ret;
> +
> if (val == 0)
> return n - 1;
>
prev parent reply other threads:[~2018-10-21 21:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-20 21:04 [PATCH 1/1] staging: iio: adc: ad7280a: handle error from __ad7280_read32() Slawomir Stepien
2018-10-21 13:17 ` 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=20181021141751.68fa7cb7@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=sst@poczta.fm \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.