Hi Takashi,
No, this actually comes at the second step in the case of SOF (ie after the machine driver is unregistered).
Actually, I just found out what's causing the issue. It is the call to snd_hda_codec_dev_free() which calls put_device() when snd_card_free() is invoked. So, adding a get_device() in snd_hda_codec_device_new() would make the refcount balanced.
On the other hand, removing the put_device() in snd_hda_codec_dev_free() would also address the problem. I'm not sure which would be the preferred route.
The latter one, I'd say.
Actually the difference between ASoC and the legacy HDA bus is who releases the device object. For HDA legacy bus, it's supposed to be done via snd_device_free() chain, while ASoC bus releases explicitly as shown in my previous post.
So, if any, I'd paper over it like below.
OK, makes sense. Let me send a V2 with the change.
Also, should I also look into adding the change to make hdac_hdmi codec card managed as well?
Thanks, Ranjani
thanks,
Takashi
--- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -840,7 +840,12 @@ static int snd_hda_codec_dev_free(struct snd_device *device) if (codec->core.type == HDA_DEV_LEGACY) snd_hdac_device_unregister(&codec->core); codec_display_power(codec, false);
- put_device(hda_codec_dev(codec));
- /*
* again, ASoC HD-audio bus manages differently; it's released
in
* snd_hdac_ext_bus_device_remove() explicitly
*/
- if (codec->core.type == HDA_DEV_LEGACY)
return 0;put_device(hda_codec_dev(codec));
}