brcm2708: add kernel 4.14 support
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0202-drm-vc4-Fix-crash-if-we-have-to-unbind-HDMI.patch
1 From 1254dfa5b20336d10e9cf917cdf94c63b4cc44e1 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Mon, 13 Nov 2017 14:23:48 -0800
4 Subject: [PATCH 202/454] drm/vc4: Fix crash if we have to unbind HDMI.
5
6 We need the card to unregister before the codec that the card
7 references.
8
9 Signed-off-by: Eric Anholt <eric@anholt.net>
10 ---
11 drivers/gpu/drm/vc4/vc4_hdmi.c | 7 +++++--
12 1 file changed, 5 insertions(+), 2 deletions(-)
13
14 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
15 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
16 @@ -1130,7 +1130,7 @@ static int vc4_hdmi_audio_init(struct vc
17 * snd_soc_card_get_drvdata() if needed.
18 */
19 snd_soc_card_set_drvdata(card, hdmi);
20 - ret = devm_snd_soc_register_card(dev, card);
21 + ret = snd_soc_register_card(card);
22 if (ret) {
23 dev_err(dev, "Could not register sound card: %d\n", ret);
24 goto unregister_codec;
25 @@ -1147,13 +1147,16 @@ unregister_codec:
26 static void vc4_hdmi_audio_cleanup(struct vc4_hdmi *hdmi)
27 {
28 struct device *dev = &hdmi->pdev->dev;
29 + struct snd_soc_card *card = &hdmi->audio.card;
30
31 /*
32 * If drvdata is not set this means the audio card was not
33 * registered, just skip codec unregistration in this case.
34 */
35 - if (dev_get_drvdata(dev))
36 + if (dev_get_drvdata(dev)) {
37 + snd_soc_unregister_card(card);
38 snd_soc_unregister_codec(dev);
39 + }
40 }
41
42 #ifdef CONFIG_DRM_VC4_HDMI_CEC