Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: fsl: mpc5200_dma: Convert to devm_ioremap()

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>
Link: https://patch.msgid.link/20260324224530.102164-1-jihed.chaibi.dev@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jihed Chaibi and committed by
Mark Brown
3b6f4cfc e113ed3e

+3 -8
+3 -8
sound/soc/fsl/mpc5200_dma.c
··· 326 326 dev_err(&op->dev, "Missing reg property\n"); 327 327 return -ENODEV; 328 328 } 329 - regs = ioremap(res.start, resource_size(&res)); 329 + regs = devm_ioremap(&op->dev, res.start, resource_size(&res)); 330 330 if (!regs) { 331 331 dev_err(&op->dev, "Could not map registers\n"); 332 332 return -ENODEV; ··· 334 334 335 335 /* Allocate and initialize the driver private data */ 336 336 psc_dma = kzalloc_obj(*psc_dma); 337 - if (!psc_dma) { 338 - ret = -ENOMEM; 339 - goto out_unmap; 340 - } 337 + if (!psc_dma) 338 + return -ENOMEM; 341 339 342 340 /* Get the PSC ID */ 343 341 prop = of_get_property(op->dev.of_node, "cell-index", &size); ··· 422 424 free_irq(psc_dma->playback.irq, &psc_dma->playback); 423 425 out_free: 424 426 kfree(psc_dma); 425 - out_unmap: 426 - iounmap(regs); 427 427 return ret; 428 428 } 429 429 EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create); ··· 440 444 free_irq(psc_dma->capture.irq, &psc_dma->capture); 441 445 free_irq(psc_dma->playback.irq, &psc_dma->playback); 442 446 443 - iounmap(psc_dma->psc_regs); 444 447 kfree(psc_dma); 445 448 dev_set_drvdata(&op->dev, NULL); 446 449