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]> --- drivers/dma/fsldma.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index dac12de06ef5..e4a3315a7d9d 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1238,19 +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) { - dev_err(&op->dev, "unable to ioremap registers\n"); - return -ENOMEM; - } + 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; } @@ -1321,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; } @@ -1354,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
