* [PATCH] dmaengine: bestcomm: ioremap early
@ 2026-08-23 4:49 Rosen Penev
2026-08-23 8:00 ` Markus Elfring
2026-08-24 15:25 ` [PATCH] " Frank Li
0 siblings, 2 replies; 7+ messages in thread
From: Rosen Penev @ 2026-08-23 4:49 UTC (permalink / raw)
To: dmaengine; +Cc: Vinod Koul, Frank Li, open list
Doing so allows handling potential -EPROBE_DEFER before any work gets
done.
Replace the open-coded resource lookup, request_mem_region, ioremap and
the manual iounmap/release_mem_region cleanup in probe/remove with the
managed devm_platform_get_and_ioremap_resource() helper. This removes the
now-unused error-unmap/release paths and simplifies probing.
This also fixes a resource size mismatch between allocating and freeing.
From sashiko:
> release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
This is a pre-existing issue, but does this mismatch in size during release
cause a permanent resource leak?
The memory region is requested earlier in mpc52xx_bcom_probe() using the
device tree node size:
if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
DRIVER_NAME)) {
However, the error path above attempts to release the region using a fixed
compile-time size: sizeof(struct mpc52xx_sdma). Since __release_region()
strictly verifies the boundaries of the requested resource, if these sizes
differ, the check fails and the I/O memory region is never freed. Driver
unbinding in mpc52xx_bcom_remove() also uses this same fixed size.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/dma/bestcomm/bestcomm.c | 45 ++++++++-------------------------
1 file changed, 10 insertions(+), 35 deletions(-)
diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
index 432b43520ddc..44ff4a42376b 100644
--- a/drivers/dma/bestcomm/bestcomm.c
+++ b/drivers/dma/bestcomm/bestcomm.c
@@ -13,7 +13,6 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/of.h>
-#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <asm/io.h>
@@ -365,13 +364,19 @@ bcom_engine_cleanup(void)
static int mpc52xx_bcom_probe(struct platform_device *op)
{
struct device_node *ofn_sram;
- struct resource res_bcom;
+ struct resource *res_bcom;
+ void __iomem *regs;
int rv;
/* Inform user we're ok so far */
printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
+ /* Get, reserve & map io */
+ regs = devm_platform_get_and_ioremap_resource(op, 0, &res_bcom);
+ if (IS_ERR(regs))
+ return PTR_ERR(regs);
+
/* Get the bestcomm node */
of_node_get(op->dev.of_node);
@@ -402,35 +407,13 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
/* Save the node */
bcom_eng->ofnode = op->dev.of_node;
- /* Get, reserve & map io */
- if (of_address_to_resource(op->dev.of_node, 0, &res_bcom)) {
- printk(KERN_ERR DRIVER_NAME ": "
- "Can't get resource\n");
- rv = -EINVAL;
- goto error_sramclean;
- }
-
- if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
- DRIVER_NAME)) {
- printk(KERN_ERR DRIVER_NAME ": "
- "Can't request registers region\n");
- rv = -EBUSY;
- goto error_sramclean;
- }
-
- bcom_eng->regs_base = res_bcom.start;
- bcom_eng->regs = ioremap(res_bcom.start, sizeof(struct mpc52xx_sdma));
- if (!bcom_eng->regs) {
- printk(KERN_ERR DRIVER_NAME ": "
- "Can't map registers\n");
- rv = -ENOMEM;
- goto error_release;
- }
+ bcom_eng->regs = regs;
+ bcom_eng->regs_base = res_bcom->start;
/* Now, do the real init */
rv = bcom_engine_init();
if (rv)
- goto error_unmap;
+ goto error_sramclean;
/* Done ! */
printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n",
@@ -439,10 +422,6 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
return 0;
/* Error path */
-error_unmap:
- iounmap(bcom_eng->regs);
-error_release:
- release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
error_sramclean:
kfree(bcom_eng);
bcom_sram_cleanup();
@@ -463,10 +442,6 @@ static void mpc52xx_bcom_remove(struct platform_device *op)
/* Cleanup SRAM */
bcom_sram_cleanup();
- /* Release regs */
- iounmap(bcom_eng->regs);
- release_mem_region(bcom_eng->regs_base, sizeof(struct mpc52xx_sdma));
-
/* Release the node */
of_node_put(bcom_eng->ofnode);
--
2.55.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] dmaengine: bestcomm: ioremap early
2026-08-23 4:49 [PATCH] dmaengine: bestcomm: ioremap early Rosen Penev
@ 2026-08-23 8:00 ` Markus Elfring
2026-08-24 20:23 ` Rosen Penev
2026-08-24 15:25 ` [PATCH] " Frank Li
1 sibling, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2026-08-23 8:00 UTC (permalink / raw)
To: Rosen Penev, dmaengine; +Cc: LKML, kernel-janitors, Frank Li, Vinod Koul
…
> This also fixes a resource size mismatch between allocating and freeing.
> From sashiko:
>
> > release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
>
> This is a pre-existing issue, but does this mismatch in size during release
> cause a permanent resource leak?
…
> ---
> drivers/dma/bestcomm/bestcomm.c | 45 ++++++++-------------------------
…
I would prefer a clearer separation between manual descriptions
and tool-generated data.
Can quoting styles be improved accordingly?
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dmaengine: bestcomm: ioremap early
2026-08-23 8:00 ` Markus Elfring
@ 2026-08-24 20:23 ` Rosen Penev
2026-08-25 7:56 ` Markus Elfring
0 siblings, 1 reply; 7+ messages in thread
From: Rosen Penev @ 2026-08-24 20:23 UTC (permalink / raw)
To: Markus Elfring; +Cc: dmaengine, LKML, kernel-janitors, Frank Li, Vinod Koul
On Sun, Aug 23, 2026 at 1:00 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> …
> > This also fixes a resource size mismatch between allocating and freeing.
> > From sashiko:
> >
> > > release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> >
> > This is a pre-existing issue, but does this mismatch in size during release
> > cause a permanent resource leak?
> …
> > ---
> > drivers/dma/bestcomm/bestcomm.c | 45 ++++++++-------------------------
> …
>
> I would prefer a clearer separation between manual descriptions
> and tool-generated data.
> Can quoting styles be improved accordingly?
what do you have in mind?
>
> Regards,
> Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dmaengine: bestcomm: ioremap early
2026-08-23 4:49 [PATCH] dmaengine: bestcomm: ioremap early Rosen Penev
2026-08-23 8:00 ` Markus Elfring
@ 2026-08-24 15:25 ` Frank Li
2026-08-24 20:24 ` Rosen Penev
1 sibling, 1 reply; 7+ messages in thread
From: Frank Li @ 2026-08-24 15:25 UTC (permalink / raw)
To: Rosen Penev; +Cc: dmaengine, Vinod Koul, Frank Li, open list
On Sat, Aug 22, 2026 at 09:49:00PM -0700, Rosen Penev wrote:
subject: dmaengine: bestcomm: use devm_platform_get_and_ioremap_resource() to simplify code
> Doing so allows handling potential -EPROBE_DEFER before any work gets
> done.
>
> Replace the open-coded resource lookup, request_mem_region, ioremap and
> the manual iounmap/release_mem_region cleanup in probe/remove with the
> managed devm_platform_get_and_ioremap_resource() helper. This removes the
> now-unused error-unmap/release paths and simplifies probing.
>
> This also fixes a resource size mismatch between allocating and freeing.
> From sashiko:
>
> > release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
>
> This is a pre-existing issue, but does this mismatch in size during release
> cause a permanent resource leak?
%s/?/.
> The memory region is requested earlier in mpc52xx_bcom_probe() using the
> device tree node size:
> if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
> DRIVER_NAME)) {
> However, the error path above attempts to release the region using a fixed
> compile-time size: sizeof(struct mpc52xx_sdma). Since __release_region()
> strictly verifies the boundaries of the requested resource, if these sizes
> differ, the check fails and the I/O memory region is never freed. Driver
> unbinding in mpc52xx_bcom_remove() also uses this same fixed size.
Needn't this paragraph, "devm_platform_get_and_ioremap_resource..." already
clear enough.
Frank
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/dma/bestcomm/bestcomm.c | 45 ++++++++-------------------------
> 1 file changed, 10 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> index 432b43520ddc..44ff4a42376b 100644
> --- a/drivers/dma/bestcomm/bestcomm.c
> +++ b/drivers/dma/bestcomm/bestcomm.c
> @@ -13,7 +13,6 @@
> #include <linux/kernel.h>
> #include <linux/slab.h>
> #include <linux/of.h>
> -#include <linux/of_address.h>
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> #include <asm/io.h>
> @@ -365,13 +364,19 @@ bcom_engine_cleanup(void)
> static int mpc52xx_bcom_probe(struct platform_device *op)
> {
> struct device_node *ofn_sram;
> - struct resource res_bcom;
> + struct resource *res_bcom;
> + void __iomem *regs;
>
> int rv;
>
> /* Inform user we're ok so far */
> printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
>
> + /* Get, reserve & map io */
> + regs = devm_platform_get_and_ioremap_resource(op, 0, &res_bcom);
> + if (IS_ERR(regs))
> + return PTR_ERR(regs);
> +
> /* Get the bestcomm node */
> of_node_get(op->dev.of_node);
>
> @@ -402,35 +407,13 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> /* Save the node */
> bcom_eng->ofnode = op->dev.of_node;
>
> - /* Get, reserve & map io */
> - if (of_address_to_resource(op->dev.of_node, 0, &res_bcom)) {
> - printk(KERN_ERR DRIVER_NAME ": "
> - "Can't get resource\n");
> - rv = -EINVAL;
> - goto error_sramclean;
> - }
> -
> - if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
> - DRIVER_NAME)) {
> - printk(KERN_ERR DRIVER_NAME ": "
> - "Can't request registers region\n");
> - rv = -EBUSY;
> - goto error_sramclean;
> - }
> -
> - bcom_eng->regs_base = res_bcom.start;
> - bcom_eng->regs = ioremap(res_bcom.start, sizeof(struct mpc52xx_sdma));
> - if (!bcom_eng->regs) {
> - printk(KERN_ERR DRIVER_NAME ": "
> - "Can't map registers\n");
> - rv = -ENOMEM;
> - goto error_release;
> - }
> + bcom_eng->regs = regs;
> + bcom_eng->regs_base = res_bcom->start;
>
> /* Now, do the real init */
> rv = bcom_engine_init();
> if (rv)
> - goto error_unmap;
> + goto error_sramclean;
>
> /* Done ! */
> printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n",
> @@ -439,10 +422,6 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> return 0;
>
> /* Error path */
> -error_unmap:
> - iounmap(bcom_eng->regs);
> -error_release:
> - release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> error_sramclean:
> kfree(bcom_eng);
> bcom_sram_cleanup();
> @@ -463,10 +442,6 @@ static void mpc52xx_bcom_remove(struct platform_device *op)
> /* Cleanup SRAM */
> bcom_sram_cleanup();
>
> - /* Release regs */
> - iounmap(bcom_eng->regs);
> - release_mem_region(bcom_eng->regs_base, sizeof(struct mpc52xx_sdma));
> -
> /* Release the node */
> of_node_put(bcom_eng->ofnode);
>
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] dmaengine: bestcomm: ioremap early
2026-08-24 15:25 ` [PATCH] " Frank Li
@ 2026-08-24 20:24 ` Rosen Penev
2026-08-25 14:39 ` Frank Li
0 siblings, 1 reply; 7+ messages in thread
From: Rosen Penev @ 2026-08-24 20:24 UTC (permalink / raw)
To: Frank Li; +Cc: dmaengine, Vinod Koul, Frank Li, open list
On Mon, Aug 24, 2026 at 8:25 AM Frank Li <Frank.li@oss.nxp.com> wrote:
>
> On Sat, Aug 22, 2026 at 09:49:00PM -0700, Rosen Penev wrote:
>
> subject: dmaengine: bestcomm: use devm_platform_get_and_ioremap_resource() to simplify code
>
>
> > Doing so allows handling potential -EPROBE_DEFER before any work gets
> > done.
> >
> > Replace the open-coded resource lookup, request_mem_region, ioremap and
> > the manual iounmap/release_mem_region cleanup in probe/remove with the
> > managed devm_platform_get_and_ioremap_resource() helper. This removes the
> > now-unused error-unmap/release paths and simplifies probing.
> >
> > This also fixes a resource size mismatch between allocating and freeing.
> > From sashiko:
> >
> > > release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> >
> > This is a pre-existing issue, but does this mismatch in size during release
> > cause a permanent resource leak?
>
> %s/?/.
>
> > The memory region is requested earlier in mpc52xx_bcom_probe() using the
> > device tree node size:
> > if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
> > DRIVER_NAME)) {
> > However, the error path above attempts to release the region using a fixed
> > compile-time size: sizeof(struct mpc52xx_sdma). Since __release_region()
> > strictly verifies the boundaries of the requested resource, if these sizes
> > differ, the check fails and the I/O memory region is never freed. Driver
> > unbinding in mpc52xx_bcom_remove() also uses this same fixed size.
>
> Needn't this paragraph, "devm_platform_get_and_ioremap_resource..." already
> clear enough.
This section is generated from Sashiko. Same as the above.
>
> Frank
>
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> > drivers/dma/bestcomm/bestcomm.c | 45 ++++++++-------------------------
> > 1 file changed, 10 insertions(+), 35 deletions(-)
> >
> > diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> > index 432b43520ddc..44ff4a42376b 100644
> > --- a/drivers/dma/bestcomm/bestcomm.c
> > +++ b/drivers/dma/bestcomm/bestcomm.c
> > @@ -13,7 +13,6 @@
> > #include <linux/kernel.h>
> > #include <linux/slab.h>
> > #include <linux/of.h>
> > -#include <linux/of_address.h>
> > #include <linux/of_irq.h>
> > #include <linux/platform_device.h>
> > #include <asm/io.h>
> > @@ -365,13 +364,19 @@ bcom_engine_cleanup(void)
> > static int mpc52xx_bcom_probe(struct platform_device *op)
> > {
> > struct device_node *ofn_sram;
> > - struct resource res_bcom;
> > + struct resource *res_bcom;
> > + void __iomem *regs;
> >
> > int rv;
> >
> > /* Inform user we're ok so far */
> > printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
> >
> > + /* Get, reserve & map io */
> > + regs = devm_platform_get_and_ioremap_resource(op, 0, &res_bcom);
> > + if (IS_ERR(regs))
> > + return PTR_ERR(regs);
> > +
> > /* Get the bestcomm node */
> > of_node_get(op->dev.of_node);
> >
> > @@ -402,35 +407,13 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> > /* Save the node */
> > bcom_eng->ofnode = op->dev.of_node;
> >
> > - /* Get, reserve & map io */
> > - if (of_address_to_resource(op->dev.of_node, 0, &res_bcom)) {
> > - printk(KERN_ERR DRIVER_NAME ": "
> > - "Can't get resource\n");
> > - rv = -EINVAL;
> > - goto error_sramclean;
> > - }
> > -
> > - if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
> > - DRIVER_NAME)) {
> > - printk(KERN_ERR DRIVER_NAME ": "
> > - "Can't request registers region\n");
> > - rv = -EBUSY;
> > - goto error_sramclean;
> > - }
> > -
> > - bcom_eng->regs_base = res_bcom.start;
> > - bcom_eng->regs = ioremap(res_bcom.start, sizeof(struct mpc52xx_sdma));
> > - if (!bcom_eng->regs) {
> > - printk(KERN_ERR DRIVER_NAME ": "
> > - "Can't map registers\n");
> > - rv = -ENOMEM;
> > - goto error_release;
> > - }
> > + bcom_eng->regs = regs;
> > + bcom_eng->regs_base = res_bcom->start;
> >
> > /* Now, do the real init */
> > rv = bcom_engine_init();
> > if (rv)
> > - goto error_unmap;
> > + goto error_sramclean;
> >
> > /* Done ! */
> > printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n",
> > @@ -439,10 +422,6 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> > return 0;
> >
> > /* Error path */
> > -error_unmap:
> > - iounmap(bcom_eng->regs);
> > -error_release:
> > - release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> > error_sramclean:
> > kfree(bcom_eng);
> > bcom_sram_cleanup();
> > @@ -463,10 +442,6 @@ static void mpc52xx_bcom_remove(struct platform_device *op)
> > /* Cleanup SRAM */
> > bcom_sram_cleanup();
> >
> > - /* Release regs */
> > - iounmap(bcom_eng->regs);
> > - release_mem_region(bcom_eng->regs_base, sizeof(struct mpc52xx_sdma));
> > -
> > /* Release the node */
> > of_node_put(bcom_eng->ofnode);
> >
> > --
> > 2.55.0
> >
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] dmaengine: bestcomm: ioremap early
2026-08-24 20:24 ` Rosen Penev
@ 2026-08-25 14:39 ` Frank Li
0 siblings, 0 replies; 7+ messages in thread
From: Frank Li @ 2026-08-25 14:39 UTC (permalink / raw)
To: Rosen Penev; +Cc: dmaengine, Vinod Koul, Frank Li, open list
On Mon, Aug 24, 2026 at 01:24:06PM -0700, Rosen Penev wrote:
> On Mon, Aug 24, 2026 at 8:25 AM Frank Li <Frank.li@oss.nxp.com> wrote:
> >
> > On Sat, Aug 22, 2026 at 09:49:00PM -0700, Rosen Penev wrote:
> >
> > subject: dmaengine: bestcomm: use devm_platform_get_and_ioremap_resource() to simplify code
> >
> >
> > > Doing so allows handling potential -EPROBE_DEFER before any work gets
> > > done.
> > >
> > > Replace the open-coded resource lookup, request_mem_region, ioremap and
> > > the manual iounmap/release_mem_region cleanup in probe/remove with the
> > > managed devm_platform_get_and_ioremap_resource() helper. This removes the
> > > now-unused error-unmap/release paths and simplifies probing.
> > >
> > > This also fixes a resource size mismatch between allocating and freeing.
> > > From sashiko:
> > >
> > > > release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> > >
> > > This is a pre-existing issue, but does this mismatch in size during release
> > > cause a permanent resource leak?
> >
> > %s/?/.
> >
> > > The memory region is requested earlier in mpc52xx_bcom_probe() using the
> > > device tree node size:
> > > if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
> > > DRIVER_NAME)) {
> > > However, the error path above attempts to release the region using a fixed
> > > compile-time size: sizeof(struct mpc52xx_sdma). Since __release_region()
> > > strictly verifies the boundaries of the requested resource, if these sizes
> > > differ, the check fails and the I/O memory region is never freed. Driver
> > > unbinding in mpc52xx_bcom_remove() also uses this same fixed size.
> >
> > Needn't this paragraph, "devm_platform_get_and_ioremap_resource..." already
> > clear enough.
> This section is generated from Sashiko. Same as the above.
AI provided more detail information to help us understand situation, but
sometime it is long-winded. Git commit need a nice summary. This is
simple code cleanup.
Frank
> >
> > Frank
> >
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > > drivers/dma/bestcomm/bestcomm.c | 45 ++++++++-------------------------
> > > 1 file changed, 10 insertions(+), 35 deletions(-)
> > >
> > > diff --git a/drivers/dma/bestcomm/bestcomm.c b/drivers/dma/bestcomm/bestcomm.c
> > > index 432b43520ddc..44ff4a42376b 100644
> > > --- a/drivers/dma/bestcomm/bestcomm.c
> > > +++ b/drivers/dma/bestcomm/bestcomm.c
> > > @@ -13,7 +13,6 @@
> > > #include <linux/kernel.h>
> > > #include <linux/slab.h>
> > > #include <linux/of.h>
> > > -#include <linux/of_address.h>
> > > #include <linux/of_irq.h>
> > > #include <linux/platform_device.h>
> > > #include <asm/io.h>
> > > @@ -365,13 +364,19 @@ bcom_engine_cleanup(void)
> > > static int mpc52xx_bcom_probe(struct platform_device *op)
> > > {
> > > struct device_node *ofn_sram;
> > > - struct resource res_bcom;
> > > + struct resource *res_bcom;
> > > + void __iomem *regs;
> > >
> > > int rv;
> > >
> > > /* Inform user we're ok so far */
> > > printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
> > >
> > > + /* Get, reserve & map io */
> > > + regs = devm_platform_get_and_ioremap_resource(op, 0, &res_bcom);
> > > + if (IS_ERR(regs))
> > > + return PTR_ERR(regs);
> > > +
> > > /* Get the bestcomm node */
> > > of_node_get(op->dev.of_node);
> > >
> > > @@ -402,35 +407,13 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> > > /* Save the node */
> > > bcom_eng->ofnode = op->dev.of_node;
> > >
> > > - /* Get, reserve & map io */
> > > - if (of_address_to_resource(op->dev.of_node, 0, &res_bcom)) {
> > > - printk(KERN_ERR DRIVER_NAME ": "
> > > - "Can't get resource\n");
> > > - rv = -EINVAL;
> > > - goto error_sramclean;
> > > - }
> > > -
> > > - if (!request_mem_region(res_bcom.start, resource_size(&res_bcom),
> > > - DRIVER_NAME)) {
> > > - printk(KERN_ERR DRIVER_NAME ": "
> > > - "Can't request registers region\n");
> > > - rv = -EBUSY;
> > > - goto error_sramclean;
> > > - }
> > > -
> > > - bcom_eng->regs_base = res_bcom.start;
> > > - bcom_eng->regs = ioremap(res_bcom.start, sizeof(struct mpc52xx_sdma));
> > > - if (!bcom_eng->regs) {
> > > - printk(KERN_ERR DRIVER_NAME ": "
> > > - "Can't map registers\n");
> > > - rv = -ENOMEM;
> > > - goto error_release;
> > > - }
> > > + bcom_eng->regs = regs;
> > > + bcom_eng->regs_base = res_bcom->start;
> > >
> > > /* Now, do the real init */
> > > rv = bcom_engine_init();
> > > if (rv)
> > > - goto error_unmap;
> > > + goto error_sramclean;
> > >
> > > /* Done ! */
> > > printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n",
> > > @@ -439,10 +422,6 @@ static int mpc52xx_bcom_probe(struct platform_device *op)
> > > return 0;
> > >
> > > /* Error path */
> > > -error_unmap:
> > > - iounmap(bcom_eng->regs);
> > > -error_release:
> > > - release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
> > > error_sramclean:
> > > kfree(bcom_eng);
> > > bcom_sram_cleanup();
> > > @@ -463,10 +442,6 @@ static void mpc52xx_bcom_remove(struct platform_device *op)
> > > /* Cleanup SRAM */
> > > bcom_sram_cleanup();
> > >
> > > - /* Release regs */
> > > - iounmap(bcom_eng->regs);
> > > - release_mem_region(bcom_eng->regs_base, sizeof(struct mpc52xx_sdma));
> > > -
> > > /* Release the node */
> > > of_node_put(bcom_eng->ofnode);
> > >
> > > --
> > > 2.55.0
> > >
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-08-25 14:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 4:49 [PATCH] dmaengine: bestcomm: ioremap early Rosen Penev
2026-08-23 8:00 ` Markus Elfring
2026-08-24 20:23 ` Rosen Penev
2026-08-25 7:56 ` Markus Elfring
2026-08-24 15:25 ` [PATCH] " Frank Li
2026-08-24 20:24 ` Rosen Penev
2026-08-25 14:39 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox