From: Jihed Chaibi <jihed.chaibi.dev@gmail.com>
To: linux-sound@vger.kernel.org
Cc: kees@kernel.org, lgirdwood@gmail.com, broonie@kernel.org,
perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org,
jihed.chaibi.dev@gmail.com
Subject: [PATCH] ASoC: fsl: mpc5200_dma: Convert to devm_ioremap()
Date: Tue, 24 Mar 2026 23:45:30 +0100 [thread overview]
Message-ID: <20260324224530.102164-1-jihed.chaibi.dev@gmail.com> (raw)
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
next reply other threads:[~2026-03-24 22:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 22:45 Jihed Chaibi [this message]
2026-03-26 13:42 ` [PATCH] ASoC: fsl: mpc5200_dma: Convert to devm_ioremap() Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260324224530.102164-1-jihed.chaibi.dev@gmail.com \
--to=jihed.chaibi.dev@gmail.com \
--cc=broonie@kernel.org \
--cc=kees@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox