From: Jonathan Cameron <jic23@kernel.org>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Siddartha Mohanadoss <smohanad@codeaurora.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Douglas Anderson <dianders@chromium.org>
Subject: Re: [PATCH] iio: adc: qcom-spmi-adc5: Verify channel numbers from DT
Date: Sun, 2 Sep 2018 18:52:28 +0100 [thread overview]
Message-ID: <20180902185228.2eadbce6@archlinux> (raw)
In-Reply-To: <20180827211453.213061-1-mka@chromium.org>
On Mon, 27 Aug 2018 14:14:53 -0700
Matthias Kaehlcke <mka@chromium.org> wrote:
> The driver only defines a subset of all possible ADC channels. Channel
> numbers read from the device tree are accepted as long as they don't
> exceed a max value, even when no channel definition exists. Add a
> check to abort initialization in this case.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.
Thanks for tidying this up.
Jonathan
> ---
> drivers/iio/adc/qcom-spmi-adc5.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
> index 9c8e6f9e8248..ab5bec917c0a 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5.c
> @@ -519,7 +519,8 @@ static int adc5_get_dt_channel_data(struct adc5_chip *adc,
> return ret;
> }
>
> - if (chan > ADC5_PARALLEL_ISENSE_VBAT_IDATA) {
> + if (chan > ADC5_PARALLEL_ISENSE_VBAT_IDATA ||
> + !data->adc_chans[chan].datasheet_name) {
> dev_err(dev, "%s invalid channel number %d\n", name, chan);
> return -EINVAL;
> }
prev parent reply other threads:[~2018-09-02 22:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 21:14 [PATCH] iio: adc: qcom-spmi-adc5: Verify channel numbers from DT Matthias Kaehlcke
2018-09-02 17:52 ` 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=20180902185228.2eadbce6@archlinux \
--to=jic23@kernel.org \
--cc=dianders@chromium.org \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mka@chromium.org \
--cc=pmeerw@pmeerw.net \
--cc=smohanad@codeaurora.org \
/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).