[alsa-devel] [PATCH v2] ASoC: hda: fix unbalanced codec dev refcount for HDA_DEV_ASOC

Takashi Iwai tiwai at suse.de
Fri May 31 19:06:02 CEST 2019


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 at linux.intel.com>

Reviewed-by: Takashi Iwai <tiwai at 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


More information about the Alsa-devel mailing list