* [PATCH] mtd: rawnand: nuvoton: Fix an error handling path in ma35_nand_chips_init()
@ 2025-07-30 19:47 Christophe JAILLET
2025-09-01 12:25 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-07-30 19:47 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Jacky Huang, Shan-Chun Hung, Hui-Ping Chen
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-mtd,
linux-arm-kernel
If a ma35_nand_chip_init() call fails, then a reference to 'nand_np' still
needs to be released.
Use for_each_child_of_node_scoped() to fix the issue.
Fixes: 5abb5d414d55 ("mtd: rawnand: nuvoton: add new driver for the Nuvoton MA35 SoC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c b/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c
index c23b537948d5..1a285cd8fad6 100644
--- a/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c
+++ b/drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c
@@ -935,10 +935,10 @@ static void ma35_chips_cleanup(struct ma35_nand_info *nand)
static int ma35_nand_chips_init(struct device *dev, struct ma35_nand_info *nand)
{
- struct device_node *np = dev->of_node, *nand_np;
+ struct device_node *np = dev->of_node;
int ret;
- for_each_child_of_node(np, nand_np) {
+ for_each_child_of_node_scoped(np, nand_np) {
ret = ma35_nand_chip_init(dev, nand, nand_np);
if (ret) {
ma35_chips_cleanup(nand);
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: rawnand: nuvoton: Fix an error handling path in ma35_nand_chips_init()
2025-07-30 19:47 [PATCH] mtd: rawnand: nuvoton: Fix an error handling path in ma35_nand_chips_init() Christophe JAILLET
@ 2025-09-01 12:25 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2025-09-01 12:25 UTC (permalink / raw)
To: Richard Weinberger, Vignesh Raghavendra, Jacky Huang,
Shan-Chun Hung, Hui-Ping Chen, Christophe JAILLET
Cc: linux-kernel, kernel-janitors, linux-mtd, linux-arm-kernel
On Wed, 30 Jul 2025 21:47:46 +0200, Christophe JAILLET wrote:
> If a ma35_nand_chip_init() call fails, then a reference to 'nand_np' still
> needs to be released.
>
> Use for_each_child_of_node_scoped() to fix the issue.
>
>
Applied to mtd/fixes, thanks!
[1/1] mtd: rawnand: nuvoton: Fix an error handling path in ma35_nand_chips_init()
commit: 1eae113dd5ff5192cfd3e11b6ab7b96193b42c01
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-01 12:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 19:47 [PATCH] mtd: rawnand: nuvoton: Fix an error handling path in ma35_nand_chips_init() Christophe JAILLET
2025-09-01 12:25 ` Miquel Raynal
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).