[alsa-devel] [PATCH] ASoC: remove a card from the list, if instantiation failed
If instantiation of a card failed, we have to remove it from the card list. This fixes an Oops on Migo-R, triggering, when after a failed firmware load attempt the driver modules are removed and re-inserted again.
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de ---
Should also be good for stable.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c8b0556..307eea0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2361,6 +2361,8 @@ static int snd_soc_register_card(struct snd_soc_card *card) mutex_lock(&client_mutex); list_add(&card->list, &card_list); snd_soc_instantiate_cards(); + if (!card->instantiated) + list_del(&card->list); mutex_unlock(&client_mutex);
dev_dbg(card->dev, "Registered card '%s'\n", card->name);
On 17 Mar 2010, at 21:06, Guennadi Liakhovetski g.liakhovetski@gmx.de wrote:
If instantiation of a card failed, we have to remove it from the card list. This fixes an Oops on Migo-R, triggering, when after a failed firmware load attempt the driver modules are removed and re-inserted again.
This looks like the wrong fix - if the card failed to instantiate because the component drivers weren't ready then it ought to hang around so it can be instantiated once they appear. Presumably some part of the instantiation attempt is failing and not being unwound properly?
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
Should also be good for stable.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c8b0556..307eea0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2361,6 +2361,8 @@ static int snd_soc_register_card(struct snd_soc_card *card) mutex_lock(&client_mutex); list_add(&card->list, &card_list); snd_soc_instantiate_cards();
if (!card->instantiated)
list_del(&card->list);
mutex_unlock(&client_mutex);
dev_dbg(card->dev, "Registered card '%s'\n", card->name);
On Wed, 17 Mar 2010, Mark Brown wrote:
On 17 Mar 2010, at 21:06, Guennadi Liakhovetski g.liakhovetski@gmx.de wrote:
If instantiation of a card failed, we have to remove it from the card list. This fixes an Oops on Migo-R, triggering, when after a failed firmware load attempt the driver modules are removed and re-inserted again.
This looks like the wrong fix - if the card failed to instantiate because the component drivers weren't ready then it ought to hang around so it can be instantiated once they appear. Presumably some part of the instantiation attempt is failing and not being unwound properly?
If snd_soc_instantiate_card() fails, when called from snd_soc_register_card(), the card currently stays on the list, but the instantiated flag is not set. If you then unload drivers and unregister the soc-audio platform device, snd_soc_unregister_card() is called, but since instantiated is not set, nothing is done and the card stays on the list. What's the proper unwind way in such a case then?
Thanks Guennadi
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
Should also be good for stable.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c8b0556..307eea0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2361,6 +2361,8 @@ static int snd_soc_register_card(struct snd_soc_card *card) mutex_lock(&client_mutex); list_add(&card->list, &card_list); snd_soc_instantiate_cards();
if (!card->instantiated)
list_del(&card->list);
mutex_unlock(&client_mutex);
dev_dbg(card->dev, "Registered card '%s'\n", card->name);
--- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/
On 17 Mar 2010, at 23:09, Guennadi Liakhovetski g.liakhovetski@gmx.de wrote:
On Wed, 17 Mar 2010, Mark Brown wrote:
On 17 Mar 2010, at 21:06, Guennadi Liakhovetski <g.liakhovetski@gmx.de
wrote:
If instantiation of a card failed, we have to remove it from the card list. This fixes an Oops on Migo-R, triggering, when after a failed firmware load attempt the driver modules are removed and re-inserted again.
This looks like the wrong fix - if the card failed to instantiate because the component drivers weren't ready then it ought to hang around so it can be instantiated once they appear. Presumably some part of the instantiation attempt is failing and not being unwound properly?
If snd_soc_instantiate_card() fails, when called from snd_soc_register_card(), the card currently stays on the list, but the instantiated flag is not set. If you then unload drivers and unregister the soc-audio platform device, snd_soc_unregister_card() is called, but since instantiated is not set, nothing is done and the card stays on the list. What's the proper unwind way in such a case then?
The card should be removed on unregistration either way.
Thanks Guennadi
Signed-off-by: Guennadi Liakhovetski g.liakhovetski@gmx.de
Should also be good for stable.
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c8b0556..307eea0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2361,6 +2361,8 @@ static int snd_soc_register_card(struct snd_soc_card *card) mutex_lock(&client_mutex); list_add(&card->list, &card_list); snd_soc_instantiate_cards();
- if (!card->instantiated)
list_del(&card->list);
mutex_unlock(&client_mutex);
dev_dbg(card->dev, "Registered card '%s'\n", card->name);
Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/
participants (2)
-
Guennadi Liakhovetski
-
Mark Brown