On Friday 07 October 2011 11:17:12 Mark Brown wrote:
On Fri, Oct 07, 2011 at 10:06:46AM +0300, Peter Ujfalusi wrote:
Calling soc_dapm_sync() after adding DAPM widgets/routes will lead to kernel crash caused by unitialized widget->power_check callback (NULL pointer dereference).
Call snd_soc_dapm_new_widgets(dapm); instead of soc_dapm_sync which will initialize the widgets, and will call the dapm_power_widgets (soc_dapm_sync is a wrapper for dapm_power_widgets).
No, there should be no need for either callback in individual drivers unless they're doing something very specialist. This will have been the case for a while now.
This might be true for machines, which adds jack functionality. We are now calling snd_soc_dapm_new_widgets before adding jack pins. Also machines passing their DAPM widgets/routes via snd_soc_card are safe from this issue.
For machines, which does not add jacks the snd_soc_dapm_new_widgets will be not called at all, which will eventually leads to a crash.
in soc-core.c: soc_post_component_init() the dai->init called, but there's no additional snd_soc_dapm_new_widgets call to make sure that the new widgets added by the machine driver are instantiated.
-- Péter