diff options
author | Cezary Rojewski <cezary.rojewski@intel.com> | 2022-10-27 10:58:40 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-11-18 16:38:27 +0100 |
commit | c7eb967d70446971413061effca3226578cb4dab (patch) | |
tree | 8ea7303efb23c892a869343c5bc669e5a178fbba /sound/soc/codecs/nau8825.c | |
parent | ASoC: mchp-spdiftx: add power saving features (diff) | |
download | linux-c7eb967d70446971413061effca3226578cb4dab.tar.xz linux-c7eb967d70446971413061effca3226578cb4dab.zip |
ASoC: core: Exit all links before removing their components
Flows leading to link->init() and link->exit() are not symmetric.
Currently the relevant part of card probe sequence goes as:
for_each_card_rtds(card, rtd)
for_each_rtd_components(rtd, i, component)
component->probe()
for_each_card_rtds(card, rtd)
for_each_rtd_dais(rtd, i, dai)
dai->probe()
for_each_card_rtds(card, rtd)
rtd->init()
On the other side, equivalent remove sequence goes as:
for_each_card_rtds(card, rtd)
for_each_rtd_dais(rtd, i, dai)
dai->remove()
for_each_card_rtds(card, rtd)
for_each_rtd_components(rtd, i, component)
component->remove()
for_each_card_rtds(card, rtd)
rtd->exit()
what can lead to errors as link->exit() may still operate on resources
owned by its components despite the probability of them being freed
during the component->remove().
This change modifies the remove sequence to:
for_each_card_rtds(card, rtd)
rtd->exit()
for_each_card_rtds(card, rtd)
for_each_rtd_dais(rtd, i, dai)
dai->remove()
for_each_card_rtds(card, rtd)
for_each_rtd_components(rtd, i, component)
component->remove()
so code found in link->exit() is safe to touch any component stuff as
component->remove() has not been called yet.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20221027085840.1562698-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/nau8825.c')
0 files changed, 0 insertions, 0 deletions