From: Jonathan Cameron <jic23@kernel.org>
To: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>,
Lee Jones <lee.jones@linaro.org>,
Samuel Ortiz <sameo@linux.intel.com>,
linux-iio@vger.kernel.org,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, support.opensource@diasemi.com
Subject: Re: [PATCH 3/8] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs
Date: Sun, 15 Jun 2014 21:20:17 +0100 [thread overview]
Message-ID: <539E0001.60005@kernel.org> (raw)
In-Reply-To: <0e7c03b0467ae1eace9dafebe6946d01d48e72f2.1402484954.git.Adam.Thomson.Opensource@diasemi.com>
On 11/06/14 12:11, Adam Thomson wrote:
> Currently in the inkern.c code for IIO framework, the function
> of_iio_channel_get_by_name() will return a non-NULL pointer when
> it cannot find a channel using of_iio_channel_get() and when it
> tries to search for 'io-channel-ranges' property and fails. This
> is incorrect behaviour as the function which calls this expects
> a NULL pointer for failure. This patch rectifies the issue.
>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Hi Adam,
Good find. I've only recently sent a pull request for fixes upstream,
so I'll pick this up in a day or so once that has gone.
J
> ---
> drivers/iio/inkern.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 0cf5f8e..1e8e94d 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
> else if (name && index >= 0) {
> pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
> np->full_name, name ? name : "", index);
> - return chan;
> + return NULL;
> }
>
> /*
> @@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
> */
> np = np->parent;
> if (np && !of_get_property(np, "io-channel-ranges", NULL))
> - break;
> + return NULL;
> }
> +
> return chan;
> }
>
> @@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
> if (channel != NULL)
> return channel;
> }
> +
> return iio_channel_get_sys(name, channel_name);
> }
> EXPORT_SYMBOL_GPL(iio_channel_get);
> --
> 1.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-06-15 20:18 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-11 11:11 [PATCH 0/8] Add initial support for DA9150 Charger & Fuel-Gauge IC Adam Thomson
2014-06-11 11:11 ` [PATCH 1/8] mfd: Add support for DA9150 combined charger & fuel-gauge device Adam Thomson
2014-06-15 19:49 ` Jonathan Cameron
2014-06-16 13:12 ` Opensource [Adam Thomson]
2014-06-16 20:13 ` Jonathan Cameron
2014-06-21 11:38 ` Jonathan Cameron
2014-06-11 11:11 ` [PATCH 2/8] mfd: da9150: Add DT binding documentation for core Adam Thomson
2014-06-11 11:11 ` [PATCH 3/8] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Adam Thomson
2014-06-15 20:20 ` Jonathan Cameron [this message]
2014-06-21 11:32 ` Jonathan Cameron
2014-06-11 11:11 ` [PATCH 4/8] iio: Add support for DA9150 GPADC Adam Thomson
2014-06-11 16:34 ` Jonathan Cameron
2014-06-11 16:56 ` Opensource [Adam Thomson]
2014-06-15 19:55 ` Jonathan Cameron
2014-06-15 20:19 ` Jonathan Cameron
2014-06-16 15:58 ` Opensource [Adam Thomson]
2014-06-21 11:29 ` Jonathan Cameron
2014-06-11 11:11 ` [PATCH 5/8] iio: da9150: Add DT binding documentation for GPADC Adam Thomson
2014-06-11 11:11 ` [PATCH 6/8] power: Add support for DA9150 Charger Adam Thomson
2014-06-16 13:27 ` Lee Jones
2014-06-17 8:21 ` Opensource [Adam Thomson]
2014-06-11 11:11 ` [PATCH 7/8] power: da9150: Add DT binding documentation for charger Adam Thomson
2014-06-11 11:11 ` [PATCH 8/8] DT: Add vendor prefix for Dialog Semiconductor Ltd Adam Thomson
2014-06-11 12:09 ` Geert Uytterhoeven
2014-06-11 12:43 ` Rob Herring
2014-06-11 13:01 ` Geert Uytterhoeven
2014-06-11 13:17 ` Opensource [Adam Thomson]
2014-06-11 14:22 ` Rob Herring
2014-06-11 13:31 ` Adam Thomson
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=539E0001.60005@kernel.org \
--to=jic23@kernel.org \
--cc=Adam.Thomson.Opensource@diasemi.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lee.jones@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.com \
--cc=support.opensource@diasemi.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).