From: Jonathan Cameron <jic23@kernel.org>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: [PATCH] iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs()
Date: Sat, 22 Sep 2018 10:22:10 +0100 [thread overview]
Message-ID: <20180922102210.62576e11@archlinux> (raw)
In-Reply-To: <1537567082-7308-1-git-send-email-khoroshilov@ispras.ru>
On Sat, 22 Sep 2018 00:58:02 +0300
Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:
> Leaving for_each_child_of_node loop we should release child device node,
> if it is not stored for future use.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Seems obviously correct to me. Given we are mid way through
the cycle and this doesn't strike me as super urgent, I'll
queue it up for the next merge window.
I added a note to the description to reflect this.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks and great to clean things like this up.
Jonathan
> ---
> drivers/iio/adc/fsl-imx25-gcq.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c
> index ea264fa9e567..929c617db364 100644
> --- a/drivers/iio/adc/fsl-imx25-gcq.c
> +++ b/drivers/iio/adc/fsl-imx25-gcq.c
> @@ -209,12 +209,14 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
> ret = of_property_read_u32(child, "reg", ®);
> if (ret) {
> dev_err(dev, "Failed to get reg property\n");
> + of_node_put(child);
> return ret;
> }
>
> if (reg >= MX25_NUM_CFGS) {
> dev_err(dev,
> "reg value is greater than the number of available configuration registers\n");
> + of_node_put(child);
> return -EINVAL;
> }
>
> @@ -228,6 +230,7 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
> if (IS_ERR(priv->vref[refp])) {
> dev_err(dev, "Error, trying to use external voltage reference without a vref-%s regulator.",
> mx25_gcq_refp_names[refp]);
> + of_node_put(child);
> return PTR_ERR(priv->vref[refp]);
> }
> priv->channel_vref_mv[reg] =
> @@ -240,6 +243,7 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
> break;
> default:
> dev_err(dev, "Invalid positive reference %d\n", refp);
> + of_node_put(child);
> return -EINVAL;
> }
>
> @@ -254,10 +258,12 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
>
> if ((refp & MX25_ADCQ_CFG_REFP_MASK) != refp) {
> dev_err(dev, "Invalid fsl,adc-refp property value\n");
> + of_node_put(child);
> return -EINVAL;
> }
> if ((refn & MX25_ADCQ_CFG_REFN_MASK) != refn) {
> dev_err(dev, "Invalid fsl,adc-refn property value\n");
> + of_node_put(child);
> return -EINVAL;
> }
>
prev parent reply other threads:[~2018-09-22 9:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-21 21:58 [PATCH] iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs() Alexey Khoroshilov
2018-09-22 9:22 ` 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=20180922102210.62576e11@archlinux \
--to=jic23@kernel.org \
--cc=khoroshilov@ispras.ru \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=ldv-project@linuxtesting.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).