Skip to content

RFC Fixes for component unregister and remove

Ranjani Sridharan alsa-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ASoC: core: do not unload topology in unregister_component()sound/soc/soc-core.c+0 -25 replies
2/3ASoC: intel: skylake: add remove() callback for component driversound/soc/intel/skylake/skl-pcm.c+7 -01 reply
3/3ASoC: core: remove link components before cleaning up card resourcessound/soc/soc-core.c+11 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] Fixes for component unregister and remove

This set of patches aims to fix the problems seen during module unloading with the skylake driver and also with SOF. The sequence seen during snd_soc_skl module unload is that the machine driver in unregistered first which frees the snd_card. When the component driver is unregistered following this and the topology is unloaded, a null pointer dereference is encountered while removing the kcontrols because the snd_card has already been freed.

The first 2 patches fix this by removing the topology unloading from component_unregister() and moving it to the component remove() callback. This also makes the register_component() and unregister_component() calls balanced.

But this still doesnt solve the problem entirely because the component driver's remove() callback is invoked after soc_cleanup_card_resources() which frees the snd_card. And we encounter the same null pointer dereference seen while remving the kcontrols added to the snd_card.

In order to avoid this problem, the third patch proposes to remove the link components in snd_soc_unbind_card() before soc_cleanup_card_resources(). This way, the snd_card() will remain valid when the topology is unloaded.

Ranjani Sridharan (3):
ASoC: core: do not unload topology in unregister_component()
ASoC: intel: skylake: add remove() callback for component driver
ASoC: core: remove link components before cleaning up card resources

 sound/soc/intel/skylake/skl-pcm.c |  7 +++++++
 sound/soc/soc-core.c              | 13 +++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.1