Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: ams-delta.c: use component after check

static void cx81801_close()
{
...
(A) struct snd_soc_dapm_context *dapm = &component->card->dapm;
...
(B) if (!component)
return;
}

(A) uses component before NULL check (B). This patch moves it after (B).

Fixes: d0fdfe34080c ("ASoC: cx20442: replace codec to component")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/3e608474-e99a-4866-ae98-3054a4221f09@moroto.mountain
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ttqdq623.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
bd0f7498 a65cdffb

+3 -1
+3 -1
sound/soc/ti/ams-delta.c
··· 301 301 static void cx81801_close(struct tty_struct *tty) 302 302 { 303 303 struct snd_soc_component *component = tty->disc_data; 304 - struct snd_soc_dapm_context *dapm = &component->card->dapm; 304 + struct snd_soc_dapm_context *dapm; 305 305 306 306 del_timer_sync(&cx81801_timer); 307 307 ··· 312 312 return; 313 313 314 314 v253_ops.close(tty); 315 + 316 + dapm = &component->card->dapm; 315 317 316 318 /* Revert back to default audio input/output constellation */ 317 319 snd_soc_dapm_mutex_lock(dapm);