Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jialin Zhang <zhangjialin11@huawei.com>
Cc: <prabhakar.mahadev-lad.rj@bp.renesas.com>, <lars@metafoo.de>,
	<biju.das.jz@bp.renesas.com>, <linux-iio@vger.kernel.org>,
	<linux-renesas-soc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: adc: rzg2l_adc: add missing fwnode_handle_put() in rzg2l_adc_parse_properties()
Date: Sun, 22 May 2022 12:28:15 +0100	[thread overview]
Message-ID: <20220522122815.60f09ab7@jic23-huawei> (raw)
In-Reply-To: <20220517033526.2035735-1-zhangjialin11@huawei.com>

On Tue, 17 May 2022 11:35:26 +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.
> 
> Fixes: d484c21bacfa ("iio: adc: Add driver for Renesas RZ/G2L A/D converter")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/rzg2l_adc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c
> index 7585144b9715..5b09a93fdf34 100644
> --- a/drivers/iio/adc/rzg2l_adc.c
> +++ b/drivers/iio/adc/rzg2l_adc.c
> @@ -334,11 +334,15 @@ static int rzg2l_adc_parse_properties(struct platform_device *pdev, struct rzg2l
>  	i = 0;
>  	device_for_each_child_node(&pdev->dev, fwnode) {
>  		ret = fwnode_property_read_u32(fwnode, "reg", &channel);
> -		if (ret)
> +		if (ret) {
> +			fwnode_handle_put(fwnode);
>  			return ret;
> +		}
>  
> -		if (channel >= RZG2L_ADC_MAX_CHANNELS)
> +		if (channel >= RZG2L_ADC_MAX_CHANNELS) {
> +			fwnode_handle_put(fwnode);
>  			return -EINVAL;
> +		}
>  
>  		chan_array[i].type = IIO_VOLTAGE;
>  		chan_array[i].indexed = 1;


      parent reply	other threads:[~2022-05-22 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  3:35 [PATCH] iio: adc: rzg2l_adc: add missing fwnode_handle_put() in rzg2l_adc_parse_properties() Jialin Zhang
2022-05-17  7:06 ` Geert Uytterhoeven
2022-05-18 19:36 ` Lad, Prabhakar
2022-05-22 11:28 ` 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=20220522122815.60f09ab7@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.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