linux/sound/soc/sof
Kai Vehmanen 9c25af2502
ASoC: SOF: Intel: fix page fault at probe if i915 init fails
The earlier commit to fix runtime PM in case i915 init fails,
introduces a possibility to hit a page fault.

snd_hdac_ext_bus_device_exit() is designed to be called from
dev.release(). Calling it outside device reference counting, is
not safe and may lead to calling the device_exit() function
twice. Additionally, as part of ext_bus_device_init(), the device
is also registered with snd_hdac_device_register(). Thus before
calling device_exit(), the device must be removed from device
hierarchy first.

Fix the issue by rolling back init actions by calling
hdac_device_unregister() and then releasing device with put_device().
This matches with existing code in hdac-ext module.

To complete the fix, add handling for the case where
hda_codec_load_module() returns -ENODEV, and clean up the hdac_ext
resources also in this case.

In future work, hdac-ext interface should be extended to allow clients
more flexibility to handle the life-cycle of individual devices, beyond
just the current snd_hdac_ext_bus_device_remove(), which removes all
devices.

BugLink: https://github.com/thesofproject/linux/issues/2646
Reported-by: Jaroslav Kysela <perex@perex.cz>
Fixes: 6c63c954e1 ("ASoC: SOF: fix a runtime pm issue in SOF when HDMI codec doesn't work")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Libin Yang <libin.yang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Link: https://lore.kernel.org/r/20210113150715.3992635-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-13 16:33:40 +00:00
..
imx ASoC: SOF: imx: update kernel-doc description 2020-12-11 13:23:03 +00:00
intel ASoC: SOF: Intel: fix page fault at probe if i915 init fails 2021-01-13 16:33:40 +00:00
xtensa ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
compress.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
compress.h ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
control.c ASoC: SOF: control: override volume info callback 2020-11-20 13:49:05 +00:00
core.c ASoC: SOF: core: fix null-ptr-deref bug during device removal 2020-07-08 15:02:02 +01:00
debug.c ASoC: SOF: modify the SOF_DBG flags 2020-12-11 13:22:57 +00:00
ipc.c ASoC: SOF: Add memory_info file to debugfs 2020-11-25 11:07:17 +00:00
Kconfig ASoC: SOF: Fix spelling mistake in Kconfig "ond" -> "and" 2020-12-16 13:53:51 +00:00
loader.c ASoC: SOF: Intel: hda: fix the condition passed to sof_dev_dbg_or_err 2020-12-11 13:22:58 +00:00
Makefile ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
nocodec.c ASoC: SOF: nocodec: modify DAI link definitions 2020-11-20 16:42:14 +00:00
ops.c ASoC: SOF: modify the SOF_DBG flags 2020-12-11 13:22:57 +00:00
ops.h ASoC: SOF: ops: modify the signature of stall op 2020-11-27 17:23:06 +00:00
pcm.c ASoC: SOF: nocodec: modify DAI link definitions 2020-11-20 16:42:14 +00:00
pm.c ASoC: SOF: pm: Fix prepare callback behavior for OF usecase 2020-09-21 17:28:10 +01:00
probe.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
probe.h ASoC: SOF: Replace zero-length array with flexible-array 2020-06-15 23:08:32 -05:00
sof-acpi-dev.c ASoC: SOF: acpi: add dynamic selection of DSP driver 2020-11-19 18:24:39 +00:00
sof-audio.c ASoC: SOF: nocodec: modify DAI link definitions 2020-11-20 16:42:14 +00:00
sof-audio.h ASoC: SOF: control: fix cppcheck warning in snd_sof_volume_info() 2020-12-04 23:26:32 +00:00
sof-of-dev.c ASoC: SOF: Add .prepare/.complete callbacks 2020-09-25 18:53:12 +01:00
sof-pci-dev.c ASoC: SOF: Intel: add SoundWire support for ADL-S 2020-12-09 16:52:05 +00:00
sof-priv.h ASoC: SOF: Intel: hda: fix the condition passed to sof_dev_dbg_or_err 2020-12-11 13:22:58 +00:00
topology.c ASoC: SOF: control: override volume info callback 2020-11-20 13:49:05 +00:00
trace.c ASoC: SOF: trace: Add runtime trace filtering mechanism 2020-12-07 14:22:05 +00:00
utils.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00