linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: ad9523: fix a missing check of return value
Date: Sat, 22 Dec 2018 17:34:54 +0000	[thread overview]
Message-ID: <20181222173454.5387f5bc@archlinux> (raw)
In-Reply-To: <20181220072122.40469-1-kjlu@umn.edu>

On Thu, 20 Dec 2018 01:21:22 -0600
Kangjie Lu <kjlu@umn.edu> wrote:

> If ad9523_write() fails, indio_dev may get incorrect data. The fix
> inserts a check for the return value of ad9523_write(), and it fails,
> returns an error.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/frequency/ad9523.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
> index f3f94fbdd20a..3f9be69499ec 100644
> --- a/drivers/iio/frequency/ad9523.c
> +++ b/drivers/iio/frequency/ad9523.c
> @@ -943,11 +943,14 @@ static int ad9523_setup(struct iio_dev *indio_dev)
>  		}
>  	}
>  
> -	for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN)
> -		ad9523_write(indio_dev,
> +	for_each_clear_bit(i, &active_mask, AD9523_NUM_CHAN) {
> +		ret = ad9523_write(indio_dev,
>  			     AD9523_CHANNEL_CLOCK_DIST(i),
>  			     AD9523_CLK_DIST_DRIVER_MODE(TRISTATE) |
>  			     AD9523_CLK_DIST_PWR_DOWN_EN);
> +		if (ret < 0)
> +			return ret;
> +	}
>  
>  	ret = ad9523_write(indio_dev, AD9523_POWER_DOWN_CTRL, 0);
>  	if (ret < 0)


      reply	other threads:[~2018-12-22 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  7:21 [PATCH] iio: ad9523: fix a missing check of return value Kangjie Lu
2018-12-22 17:34 ` 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=20181222173454.5387f5bc@archlinux \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=kjlu@umn.edu \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=pmeerw@pmeerw.net \
    /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).