From: Jonathan Cameron <jic23@kernel.org>
To: Jialin Zhang <zhangjialin11@huawei.com>
Cc: <tomislav.denis@avl.com>, <lars@metafoo.de>,
<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: adc: ti-ads131e08: add missing fwnode_handle_put() in ads131e08_alloc_channels()
Date: Sun, 22 May 2022 12:32:25 +0100 [thread overview]
Message-ID: <20220522123225.3f948d5e@jic23-huawei> (raw)
In-Reply-To: <20220517033020.2033324-1-zhangjialin11@huawei.com>
On Tue, 17 May 2022 11:30:20 +0800
Jialin Zhang <zhangjialin11@huawei.com> wrote:
> fwnode_handle_put() should be used when terminating
> device_for_each_child_node() iteration with break or
> return to prevent stale device node references from
> being left behind.
This one seems obviously correct so I'll not wait on anyone else
looking at it - still time though as I won't be sending a pull
request until these have been in next for a day or two.
Applied to the fixes-togreg branch of iio.git.
I rewrapped the description to use longer lines.
Jonathan
>
> Fixes: d935eddd2799 ("iio: adc: Add driver for Texas Instruments ADS131E0x ADC family")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
> ---
> drivers/iio/adc/ti-ads131e08.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c
> index 0c2025a22575..80a09817c119 100644
> --- a/drivers/iio/adc/ti-ads131e08.c
> +++ b/drivers/iio/adc/ti-ads131e08.c
> @@ -739,7 +739,7 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev)
> device_for_each_child_node(dev, node) {
> ret = fwnode_property_read_u32(node, "reg", &channel);
> if (ret)
> - return ret;
> + goto err_child_out;
>
> ret = fwnode_property_read_u32(node, "ti,gain", &tmp);
> if (ret) {
> @@ -747,7 +747,7 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev)
> } else {
> ret = ads131e08_pga_gain_to_field_value(st, tmp);
> if (ret < 0)
> - return ret;
> + goto err_child_out;
>
> channel_config[i].pga_gain = tmp;
> }
> @@ -758,7 +758,7 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev)
> } else {
> ret = ads131e08_validate_channel_mux(st, tmp);
> if (ret)
> - return ret;
> + goto err_child_out;
>
> channel_config[i].mux = tmp;
> }
> @@ -784,6 +784,10 @@ static int ads131e08_alloc_channels(struct iio_dev *indio_dev)
> st->channel_config = channel_config;
>
> return 0;
> +
> +err_child_out:
> + fwnode_handle_put(node);
> + return ret;
> }
>
> static void ads131e08_regulator_disable(void *data)
prev parent reply other threads:[~2022-05-22 11:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 3:30 Jialin Zhang
2022-05-22 11:32 ` 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=20220522123225.3f948d5e@jic23-huawei \
--to=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tomislav.denis@avl.com \
--cc=zhangjialin11@huawei.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
all inboxes | Powered by JetHome®