sound/soc/fsl/mpc5200_dma.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Replace ioremap() with devm_ioremap() so the mapping is released
automatically when the device is unbound. Remove the corresponding
iounmap() calls from the error path in mpc5200_audio_dma_create() and
from mpc5200_audio_dma_destroy().
Since devm_ioremap() failure already returns directly and no other
cleanup is needed at that point, simplify the kzalloc error path to
return -ENOMEM directly instead of jumping to the now-removed out_unmap
label.
Signed-off-by: Jihed Chaibi <jihed.chaibi.dev@gmail.com>
---
sound/soc/fsl/mpc5200_dma.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index a593a95aa532..a0d95473bec0 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -326,7 +326,7 @@ int mpc5200_audio_dma_create(struct platform_device *op)
dev_err(&op->dev, "Missing reg property\n");
return -ENODEV;
}
- regs = ioremap(res.start, resource_size(&res));
+ regs = devm_ioremap(&op->dev, res.start, resource_size(&res));
if (!regs) {
dev_err(&op->dev, "Could not map registers\n");
return -ENODEV;
@@ -334,10 +334,8 @@ int mpc5200_audio_dma_create(struct platform_device *op)
/* Allocate and initialize the driver private data */
psc_dma = kzalloc_obj(*psc_dma);
- if (!psc_dma) {
- ret = -ENOMEM;
- goto out_unmap;
- }
+ if (!psc_dma)
+ return -ENOMEM;
/* Get the PSC ID */
prop = of_get_property(op->dev.of_node, "cell-index", &size);
@@ -424,8 +422,6 @@ int mpc5200_audio_dma_create(struct platform_device *op)
free_irq(psc_dma->playback.irq, &psc_dma->playback);
out_free:
kfree(psc_dma);
-out_unmap:
- iounmap(regs);
return ret;
}
EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create);
@@ -444,7 +440,6 @@ int mpc5200_audio_dma_destroy(struct platform_device *op)
free_irq(psc_dma->capture.irq, &psc_dma->capture);
free_irq(psc_dma->playback.irq, &psc_dma->playback);
- iounmap(psc_dma->psc_regs);
kfree(psc_dma);
dev_set_drvdata(&op->dev, NULL);
--
2.47.3
On Tue, 24 Mar 2026 23:45:30 +0100, Jihed Chaibi wrote:
> ASoC: fsl: mpc5200_dma: Convert to devm_ioremap()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1
Thanks!
[1/1] ASoC: fsl: mpc5200_dma: Convert to devm_ioremap()
https://git.kernel.org/broonie/sound/c/3b6f4cfc7152
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
© 2016 - 2026 Red Hat, Inc.