ALSA: hda: Fix put_device() inconsistency in error path
authorCezary Rojewski <cezary.rojewski@intel.com>
Wed, 6 Jul 2022 12:02:25 +0000 (14:02 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 9 Jul 2022 16:39:23 +0000 (18:39 +0200)
commitebe043a3dfcade2756a41a3956365e1bfe4198cf
tree4620207134290ff1b11baaf99d7ecbf06757ad8b
parent9c76958b396a1342f08f205c350447b4bb54b26a
ALSA: hda: Fix put_device() inconsistency in error path

AVS HDAudio bus driver does not tie with codec drivers tighly. Codec
device and its respective driver cleanup procedures are split and may
not occur one after the other. Device cleanup is performed only on
snd_hdac_ext_bus_device_remove() i.e. it's the bus driver's
responsibility. If codec component probing fails, put_device() found in
snd_hda_codec_device_new() may lead to page fault. Relocate it to
snd_hda_codec_new() to address the problem on ASoC side while keeping
status quo for snd_hda_intel.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220706120230.427296-5-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c