On Wed, Jun 10, 2026 at 08:52:40PM -0700, Rosen Penev wrote:
> Convert of_iomap() to devm_platform_ioremap_resource() to let the devm
> framework handle unmapping. This allows removing the out_iounmap
> label and the explicit iounmap() in both the probe error path and
> the remove function.
>
> The DGSR (fdev->regs) and per-channel registers (chan->regs) map
> physically distinct regions in all supported variants
> (EloPlus/Elo/Elo3), so there is no overlap risk.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <[email protected]>
> ---

Reviewed-by: Frank Li <[email protected]>

>  drivers/dma/fsldma.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index c3d2b24f8f07..e4a3315a7d9d 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -1238,17 +1238,15 @@ static int fsldma_of_probe(struct platform_device *op)
>       fdev->addr_bits = (long)device_get_match_data(fdev->dev);
>
>       /* ioremap the registers for use */
> -     fdev->regs = of_iomap(op->dev.of_node, 0);
> -     if (!fdev->regs)
> -             return dev_err_probe(&op->dev, -ENOMEM, "unable to ioremap 
> registers\n");
> +     fdev->regs = devm_platform_ioremap_resource(op, 0);
> +     if (IS_ERR(fdev->regs))
> +             return PTR_ERR(fdev->regs);
>
>       /* map the channel IRQ if it exists, but don't hookup the handler yet */
>       fdev->irq = platform_get_irq_optional(op, 0);
>       if (fdev->irq < 0) {
> -             if (fdev->irq != -ENXIO) {
> -                     err = fdev->irq;
> -                     goto out_iounmap;
> -             }
> +             if (fdev->irq != -ENXIO)
> +                     return fdev->irq;
>               fdev->irq = 0;
>       }
>
> @@ -1319,8 +1317,6 @@ static int fsldma_of_probe(struct platform_device *op)
>               if (fdev->chan[i])
>                       fsl_dma_chan_remove(fdev->chan[i]);
>       }
> -out_iounmap:
> -     iounmap(fdev->regs);
>       return err;
>  }
>
> @@ -1352,8 +1348,6 @@ static void fsldma_of_remove(struct platform_device *op)
>               if (chans[i])
>                       fsl_dma_chan_remove(chans[i]);
>       }
> -
> -     iounmap(fdev->regs);
>  }
>
>  #ifdef CONFIG_PM
> --
> 2.54.0
>

Reply via email to