On Fri, 31 May 2019 18:01:37 +0200, Ranjani Sridharan wrote:
HDA_DEV_ASOC type codec device refcounts are managed differently from HDA_DEV_LEGACY devices. The refcount is released explicitly in snd_hdac_ext_bus_device_remove() for ASOC type devices. So, remove the put_device() call in snd_hda_codec_dev_free() for such devices to make the refcount balanced. This will prevent the NULL pointer exception when the codec driver is released after the card is freed.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
Reviewed-by: Takashi Iwai tiwai@suse.de
FWIW, snd_hdac_ext_bus_device_remove() is called at the machine driver remove callback that is called from soc_remove_dai_linkes() in soc_cleanup_card_resources(). There, the order is assured that snd_card_free() gets called at first, so this change should be correct -- the HD-audio codec object gets freed at a later point for ASoC.
thanks,
Takashi