From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: vigneshr@ti.com, tudor.ambarus@linaro.org, richard@nod.at,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: hyperbus: hbmc-am654: fix an OF node reference leak
Date: Fri, 06 Dec 2024 14:29:36 +0100 [thread overview]
Message-ID: <87cyi5q6rj.fsf@bootlin.com> (raw)
In-Reply-To: <20241206114740.781053-1-joe@pf.is.s.u-tokyo.ac.jp> (Joe Hattori's message of "Fri, 6 Dec 2024 20:47:40 +0900")
Hi Joe,
On 06/12/2024 at 20:47:40 +09, Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> wrote:
> In am654_hbmc_platform_driver, .remove() and the error path of .probe()
> do not decrement the refcount of an OF node obtained by
> of_get_next_child(). Fix this by adding of_node_put() calls.
>
> Fixes: aca31ce96814 ("mtd: hyperbus: hbmc-am654: Fix direct mapping setup flash access")
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
> ---
> drivers/mtd/hyperbus/hbmc-am654.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c
> index 217f4e69233f..3e206bb34287 100644
> --- a/drivers/mtd/hyperbus/hbmc-am654.c
> +++ b/drivers/mtd/hyperbus/hbmc-am654.c
> @@ -174,18 +174,18 @@ static int am654_hbmc_probe(struct platform_device *pdev)
> priv->hbdev.np = of_get_next_child(np, NULL);
> ret = of_address_to_resource(priv->hbdev.np, 0, &res);
> if (ret)
> - return ret;
> + goto put_node;
>
> if (of_property_read_bool(dev->of_node, "mux-controls")) {
> struct mux_control *control = devm_mux_control_get(dev, NULL);
>
> if (IS_ERR(control))
> - return PTR_ERR(control);
> + goto put_node;
>
> ret = mux_control_select(control, 1);
> if (ret) {
> dev_err(dev, "Failed to select HBMC mux\n");
> - return ret;
> + goto put_node;
> }
> priv->mux_ctrl = control;
> }
> @@ -193,7 +193,7 @@ static int am654_hbmc_probe(struct platform_device *pdev)
> priv->hbdev.map.size = resource_size(&res);
> priv->hbdev.map.virt = devm_ioremap_resource(dev, &res);
> if (IS_ERR(priv->hbdev.map.virt))
> - return PTR_ERR(priv->hbdev.map.virt);
> + goto disable_mux;
This error path will return ret, whereas it should return
PTR_ERR(priv->hbdev.map.virt).
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-12-06 13:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 11:47 [PATCH] mtd: hyperbus: hbmc-am654: fix an OF node reference leak Joe Hattori
2024-12-06 13:29 ` Miquel Raynal [this message]
2024-12-06 13:39 ` Joe Hattori
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=87cyi5q6rj.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=joe@pf.is.s.u-tokyo.ac.jp \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=tudor.ambarus@linaro.org \
--cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.