linux/sound/soc/sof/intel
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
..
Kconfig ASoC: SOF: Intel: add SoundWire support for ADL-S 2020-12-09 16:52:05 +00:00
Makefile ASoC: SOF: Intel: hda: add sof_icl_ops for ICL platforms 2020-11-27 17:23:07 +00:00
apl.c ASoC: SOF: Intel: hda: define parse_platform_ext_manifest op 2020-11-27 17:23:04 +00:00
bdw.c ASoC: SOF: rename cores_mask to host_managed_cores_mask 2020-09-11 15:29:29 +01:00
byt.c ASoC: SOF: modify the SOF_DBG flags 2020-12-11 13:22:57 +00:00
cnl.c ASoC: SOF: Intel: hda: add sof_icl_ops for ICL platforms 2020-11-27 17:23:07 +00:00
ext_manifest.h ASoC: SOF: ext_manifest: parse cavs extra config data elem 2020-11-27 17:23:05 +00:00
hda-bus.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-codec.c ASoC: SOF: Intel: fix page fault at probe if i915 init fails 2021-01-13 16:33:40 +00:00
hda-compress.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-ctrl.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-dai.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hda-dsp.c ASoC: SOF: Intel: hda: Avoid checking jack on system suspend 2021-01-13 15:24:07 +00:00
hda-ipc.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda-ipc.h ASoC: SOF: Intel: hda: Add sof_tgl_ops for TGL platforms 2020-08-27 14:22:23 +01:00
hda-loader.c ASoC: SOF: Intel: hda: fix the condition passed to sof_dev_dbg_or_err 2020-12-11 13:22:58 +00:00
hda-pcm.c ASoC: SOF: Intel: add hw specific PCM constraints 2020-11-19 13:00:04 +00:00
hda-stream.c ASoC: SOF: Intel: hda: Add helper function to program ICCMAX stream 2020-08-27 14:22:19 +01:00
hda-trace.c ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only 2020-05-01 17:45:24 +01:00
hda.c ASoC: SOF: Intel: hda: fix the condition passed to sof_dev_dbg_or_err 2020-12-11 13:22:58 +00:00
hda.h ASoC: SOF: Intel: hda: Modify existing helper to disable WAKEEN 2021-01-13 15:24:06 +00:00
icl.c ASoC: SOF: Intel: hda: add sof_icl_ops for ICL platforms 2020-11-27 17:23:07 +00:00
intel-ipc.c ASoC: SOF: Intel: add hw specific PCM constraints 2020-11-19 13:00:04 +00:00
shim.h ASoC: SOF: rename cores_mask to host_managed_cores_mask 2020-09-11 15:29:29 +01:00
tgl.c ASoC: SOF: Intel: hda: define parse_platform_ext_manifest op 2020-11-27 17:23:04 +00:00