mbox series

[0/6] ASoC: use devm_snd_soc_register_card()

Message ID 877ckigepg.wl-kuninori.morimoto.gx@renesas.com
Headers show
Series ASoC: use devm_snd_soc_register_card() | expand

Message

Kuninori Morimoto Jan. 10, 2024, 1:27 a.m. UTC
Hi Mark

We can use devm_snd_soc_register_card()
instead of      snd_soc_register_card(),  and is possible
to ignore       snd_soc_unregister_card().

Kuninori Morimoto (6):
  ASoC: ti: use devm_snd_soc_register_card()
  ASoC: fsl: use devm_snd_soc_register_card()
  ASoC: atmel: use devm_snd_soc_register_card()
  ASoC: sunxi: use devm_snd_soc_register_card()
  ASoC: ux500: use devm_snd_soc_register_card()
  ASoC: cirrus: use devm_snd_soc_register_card()

 sound/soc/atmel/atmel_wm8904.c      |  4 +---
 sound/soc/atmel/mikroe-proto.c      |  8 +-------
 sound/soc/atmel/sam9g20_wm8731.c    |  5 +----
 sound/soc/atmel/tse850-pcm5142.c    |  3 +--
 sound/soc/cirrus/edb93xx.c          |  5 +----
 sound/soc/fsl/eukrea-tlv320.c       |  8 +-------
 sound/soc/fsl/p1022_ds.c            |  3 +--
 sound/soc/fsl/p1022_rdk.c           |  3 +--
 sound/soc/fsl/pcm030-audio-fabric.c |  3 +--
 sound/soc/sunxi/sun4i-codec.c       |  3 +--
 sound/soc/ti/ams-delta.c            |  7 +------
 sound/soc/ti/omap-hdmi.c            | 10 +---------
 sound/soc/ux500/mop500.c            |  3 +--
 13 files changed, 13 insertions(+), 52 deletions(-)

Comments

Takashi Iwai Jan. 10, 2024, 8:33 a.m. UTC | #1
On Wed, 10 Jan 2024 02:27:39 +0100,
Kuninori Morimoto wrote:
> 
> 
> Hi Mark
> 
> We can use devm_snd_soc_register_card()
> instead of      snd_soc_register_card(),  and is possible
> to ignore       snd_soc_unregister_card().

I haven't looked through all code changes, but in general, be careful
when the driver is releasing something else than the devres-managed
stuff.  Namely, the devres stuff is released *after* the call of
remove callback.

For example, in your patch for cirrus driver:

 static void edb93xx_remove(struct platform_device *pdev)
 {
-	struct snd_soc_card *card = platform_get_drvdata(pdev);
-
-	snd_soc_unregister_card(card);
 	ep93xx_i2s_release();
 }
 
This will end up with different call orders of soc-unregister and
ep93xx_i2s_release().  This kind of changes may easily be a hidden
source of UAF.


Takashi
Kuninori Morimoto Jan. 11, 2024, 12:02 a.m. UTC | #2
Hi Takashi, Peter

> I haven't looked through all code changes, but in general, be careful
> when the driver is releasing something else than the devres-managed
> stuff.  Namely, the devres stuff is released *after* the call of
> remove callback.

Thank you for pointing it. Indeed it should be cared.
I will fix it and do it on simple unregister case only in v2

Thank you for your help !!

Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto