ASoC: soc-dapm.c: ignore parameter NULL at snd_soc_dapm_free_widget()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 17 Oct 2022 23:36:49 +0000 (23:36 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 18 Oct 2022 18:16:38 +0000 (19:16 +0100)
Currently snd_soc_dapm_free_widget() is assuming input parameter is
non NULL. Thus, caller need to care about it.
This patch care it at snd_soc_dapm_free_widget().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wn8yowdr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/hda.c
sound/soc/intel/avs/pcm.c
sound/soc/soc-dapm.c

index a335e96..5a13065 100644 (file)
@@ -130,10 +130,8 @@ static void hda_codec_unregister_dais(struct hda_codec *codec,
                        if (strcmp(dai->driver->name, pcm->name))
                                continue;
 
-                       if (dai->playback_widget)
-                               snd_soc_dapm_free_widget(dai->playback_widget);
-                       if (dai->capture_widget)
-                               snd_soc_dapm_free_widget(dai->capture_widget);
+                       snd_soc_dapm_free_widget(dai->playback_widget);
+                       snd_soc_dapm_free_widget(dai->capture_widget);
                        snd_soc_unregister_dai(dai);
                        break;
                }
index 8fe5917..8037b15 100644 (file)
@@ -1016,10 +1016,8 @@ static void avs_component_hda_unregister_dais(struct snd_soc_component *componen
                if (!strstr(dai->driver->name, name))
                        continue;
 
-               if (dai->playback_widget)
-                       snd_soc_dapm_free_widget(dai->playback_widget);
-               if (dai->capture_widget)
-                       snd_soc_dapm_free_widget(dai->capture_widget);
+               snd_soc_dapm_free_widget(dai->playback_widget);
+               snd_soc_dapm_free_widget(dai->capture_widget);
                snd_soc_unregister_dai(dai);
        }
 }
index f9c4fd1..5280a1a 100644 (file)
@@ -2489,6 +2489,9 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
        struct snd_soc_dapm_path *p, *next_p;
        enum snd_soc_dapm_direction dir;
 
+       if (!w)
+               return;
+
        list_del(&w->list);
        list_del(&w->dirty);
        /*