From: Amadeusz Sławiński Date: Mon, 17 Jun 2019 11:36:42 +0000 (+0200) Subject: ASoC: Intel: hdac_hdmi: Set ops to NULL on remove X-Git-Tag: v5.1.20~221 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e47a8349e65ddf32f8b15058582d8e27eec44f3;p=thirdparty%2Fkernel%2Fstable.git ASoC: Intel: hdac_hdmi: Set ops to NULL on remove [ Upstream commit 0f6ff78540bd1b4df1e0f17806b0ce2e1dff0d78 ] When we unload Skylake driver we may end up calling hdac_component_master_unbind(), it uses acomp->audio_ops, which we set in hdmi_codec_probe(), so we need to set it to NULL in hdmi_codec_remove(), otherwise we will dereference no longer existing pointer. Signed-off-by: Amadeusz Sławiński Reviewed-by: Pierre-Louis Bossart Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 4de1fbfa88278..65177ca64827e 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -1880,6 +1880,12 @@ static void hdmi_codec_remove(struct snd_soc_component *component) { struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); struct hdac_device *hdev = hdmi->hdev; + int ret; + + ret = snd_hdac_acomp_register_notifier(hdev->bus, NULL); + if (ret < 0) + dev_err(&hdev->dev, "notifier unregister failed: err: %d\n", + ret); pm_runtime_disable(&hdev->dev); }