FAILED: patch "[PATCH] mtd: rawnand: ndfc: use devm_platform_ioremap_resource()" failed to apply to 5.10-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 0d66f9895f286d2fab396a71e6efeb95c4a7e5a6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 0d66f9895f286d2fab396a71e6efeb95c4a7e5a6 Mon Sep 17 00:00:00 2001
From: Rosen Penev <[email protected]>
Date: Mon, 24 Aug 2026 13:21:20 -0700
Subject: [PATCH] mtd: rawnand: ndfc: use devm_platform_ioremap_resource()
Replace the open-coded of_iomap()/iounmap() with the managed devm_platform_ioremap_resource() helper. This fixes a mapping leak on driver remove (the old code never called iounmap()) and simplifies the error path by dropping the manual cleanup in ndfc_probe().
There is no overlapping memory-region concern introduced by this
change: each supported board DT describes a single ndfc node with a unique 0x2000 register region, and the EBC parent uses dcr-reg rather than a MEM reg resource, so the newly added request_mem_region() cannot conflict with an existing reservation. Distinct chip selects map to distinct 64-bit physical addresses, so CS instances do not overlap.
--- drivers/mtd/nand/raw/ndfc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/mtd/nand/raw/ndfc.c +8 -13
@@ -185,10 +185,15 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,static int ndfc_probe (struct platform_device *ofdev) {struct ndfc_controller *ndfc; +void __iomem *ndfcbase;const __be32 *reg;u32 ccr;u32 cs; -int err, len =0 ; +int len =0 ; + + ndfcbase =devm_platform_ioremap_resource (ofdev,0 ); +if (IS_ERR (ndfcbase)) +return PTR_ERR (ndfcbase);/* Read the reg property to get the chip select */ reg =of_get_property (ofdev->dev.of_node,"reg" , &len);
@@ -210,11 +215,7 @@ static int ndfc_probe(struct platform_device *ofdev) ndfc->ofdev = ofdev;dev_set_drvdata (&ofdev->dev, ndfc); - ndfc->ndfcbase =of_iomap (ofdev->dev.of_node,0 ); -if (!ndfc->ndfcbase) { -dev_err (&ofdev->dev,"failed to get memory\n" ); -return -EIO ; - } + ndfc->ndfcbase = ndfcbase; ccr =NDFC_CCR_BS (ndfc->chip_select);
@@ -232,13 +233,7 @@ static int ndfc_probe(struct platform_device *ofdev)iowrite32be (be32_to_cpup (reg), ndfc->ndfcbase + offset); } - err =ndfc_chip_init (ndfc, ofdev->dev.of_node); -if (err) { -iounmap (ndfc->ndfcbase); -return err; - } - -return 0 ; +return ndfc_chip_init (ndfc, ofdev->dev.of_node); }static void ndfc_remove (struct platform_device *ofdev)
Signature · 1 line
2.53.0
Quoted 11 lines · Sasha Levin
The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout
FETCH_HEAD
git cherry-pick -x0d66f9895f286d2fab396a71e6efeb95c4a7e5a6
Requires cceca8cb776b03e83985578f84bd730c30d57f70 as a prerequisite. I guess I messed up and didn't add a Fixes: tag to it.
Quoted 90 lines
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'Thanks,
Sasha------------------ original commit in Linus's tree ------------------
From
0d66f9895f286d2fab396a71e6efeb95c4a7e5a6Mon Sep 17 00:00:00 2001
From: Rosen Penev <[email protected]>
Date: Mon, 24 Aug 2026 13:21:20 -0700
Subject: [PATCH] mtd: rawnand: ndfc: usedevm_platform_ioremap_resource()Replace the open-coded of_iomap()/iounmap() with the managed
devm_platform_ioremap_resource()helper. This fixes a mapping leak on driver remove (the old code never callediounmap()) and simplifies the error path by dropping the manual cleanup inndfc_probe().There is no overlapping memory-region concern introduced by this
change: each supported board DT describes a single ndfc node with a unique0x2000register region, and the EBC parent uses dcr-reg rather than a MEM reg resource, so the newly addedrequest_mem_region()cannot conflict with an existing reservation. Distinct chip selects map to distinct 64-bit physical addresses, so CS instances do not overlap.Fixes a808ad3b0d28 ("[MTD] [NAND] ndfc driver")Assisted-by opencode:hy3-freeSigned-off-by Rosen Penev <[email protected]>Signed-off-by Miquel Raynal <[email protected]>--- drivers/mtd/nand/raw/ndfc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)drivers/mtd/nand/raw/ndfc.c +8
-14@@ -185,10 +185,15 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,static int ndfc_probe (struct platform_device *ofdev) {struct ndfc_controller *ndfc; +void __iomem *ndfcbase;const __be32 *reg;u32 ccr;u32 cs; -int err, len =0 ; +int len =0 ; + + ndfcbase =devm_platform_ioremap_resource (ofdev,0 ); +if (IS_ERR (ndfcbase)) +return PTR_ERR (ndfcbase);/* Read the reg property to get the chip select */ reg =of_get_property (ofdev->dev.of_node,"reg" , &len);@@ -210,11 +215,7 @@ static int ndfc_probe(struct platform_device *ofdev) ndfc->ofdev = ofdev;dev_set_drvdata (&ofdev->dev, ndfc); - ndfc->ndfcbase =of_iomap (ofdev->dev.of_node,0 ); -if (!ndfc->ndfcbase) { -dev_err (&ofdev->dev,"failed to get memory\n" ); -return -EIO ; - } + ndfc->ndfcbase = ndfcbase; ccr =NDFC_CCR_BS (ndfc->chip_select);@@ -232,13 +233,7 @@ static int ndfc_probe(struct platform_device *ofdev)iowrite32be (be32_to_cpup (reg), ndfc->ndfcbase + offset); } - err =ndfc_chip_init (ndfc, ofdev->dev.of_node); -if (err) { -iounmap (ndfc->ndfcbase); -return err; - } - -return 0 ; +return ndfc_chip_init (ndfc, ofdev->dev.of_node); }static void ndfc_remove (struct platform_device *ofdev) --2.53.0
Sasha Levin
maintainerQuoted 2 lines
Requires
cceca8cb776b03e83985578f84bd730c30d57f70as a prerequisite. I guess I messed up and didn't add a Fixes: tag to it.
Thanks. Queued for 6.18, 6.12, 6.6, 6.1 and 5.15, together with cceca8cb776b ("mtd: rawnand: ndfc: fix gcc uninitialized var") and 4f2692a5383e ("mtd:
rawnand: ndfc: use ioread32be/iowrite32be and allow COMPILE_TEST"), which 0d66f9895f28 ("mtd: rawnand: ndfc: use devm_platform_ioremap_resource()") needs for context, and 97f9e509d839 ("mtd: rawnand: ndfc: add CONFIG_OF dependency") on top of 4f2692a5383e.
5.10 is different: 4f2692a5383e conflicts in the Kconfig there, since 5.10 has no select MTD_NAND_ECC_SW_HAMMING. A 5.10.y backport is welcome.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 1/2 mtd: rawnand: ndfc: fix gcc uninitialized var
In reply to Sasha LevinFrom: Rosen Penev <[email protected]>
[ Upstream commit cceca8cb776b03e83985578f84bd730c30d57f70 ]
Now that this can be built with COMPILE_TEST, an unassigned variable was found. Set to 0 to fix the W=1 error under GCC.
Stable-dep-of: 0d66f9895f28 ("mtd: rawnand: ndfc: use devm_platform_ioremap_resource()")
--- drivers/mtd/nand/raw/ndfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/ndfc.c +1 -1
@@ -188,7 +188,7 @@ static int ndfc_probe(struct platform_device *ofdev)const __be32 *reg;u32 ccr;u32 cs; -int err, len; +int err, len =0 ;/* Read the reg property to get the chip select */ reg =of_get_property (ofdev->dev.of_node,"reg" , &len);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 mtd: rawnand: ndfc: use devm_platform_ioremap_resource()
From: Rosen Penev <[email protected]>
[ Upstream commit 0d66f9895f286d2fab396a71e6efeb95c4a7e5a6 ]
Replace the open-coded of_iomap()/iounmap() with the managed devm_platform_ioremap_resource() helper. This fixes a mapping leak on driver remove (the old code never called iounmap()) and simplifies the error path by dropping the manual cleanup in ndfc_probe().
There is no overlapping memory-region concern introduced by this
change: each supported board DT describes a single ndfc node with a unique 0x2000 register region, and the EBC parent uses dcr-reg rather than a MEM reg resource, so the newly added request_mem_region() cannot conflict with an existing reservation. Distinct chip selects map to distinct 64-bit physical addresses, so CS instances do not overlap.
--- drivers/mtd/nand/raw/ndfc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/mtd/nand/raw/ndfc.c +8 -13
@@ -185,10 +185,15 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,static int ndfc_probe (struct platform_device *ofdev) {struct ndfc_controller *ndfc; +void __iomem *ndfcbase;const __be32 *reg;u32 ccr;u32 cs; -int err, len =0 ; +int len =0 ; + + ndfcbase =devm_platform_ioremap_resource (ofdev,0 ); +if (IS_ERR (ndfcbase)) +return PTR_ERR (ndfcbase);/* Read the reg property to get the chip select */ reg =of_get_property (ofdev->dev.of_node,"reg" , &len);
@@ -210,11 +215,7 @@ static int ndfc_probe(struct platform_device *ofdev) ndfc->ofdev = ofdev;dev_set_drvdata (&ofdev->dev, ndfc); - ndfc->ndfcbase =of_iomap (ofdev->dev.of_node,0 ); -if (!ndfc->ndfcbase) { -dev_err (&ofdev->dev,"failed to get memory\n" ); -return -EIO ; - } + ndfc->ndfcbase = ndfcbase; ccr =NDFC_CCR_BS (ndfc->chip_select);
@@ -232,13 +233,7 @@ static int ndfc_probe(struct platform_device *ofdev)out_be32 (ndfc->ndfcbase + offset,be32_to_cpup (reg)); } - err =ndfc_chip_init (ndfc, ofdev->dev.of_node); -if (err) { -iounmap (ndfc->ndfcbase); -return err; - } - -return 0 ; +return ndfc_chip_init (ndfc, ofdev->dev.of_node); }static int ndfc_remove (struct platform_device *ofdev)
Signature · 1 line
2.53.0