Skip to content

Commit bd0f749

Browse files
morimotobroonie
authored andcommitted
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: d0fdfe3 ("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>
1 parent a65cdff commit bd0f749

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/soc/ti/ams-delta.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
301301
static void cx81801_close(struct tty_struct *tty)
302302
{
303303
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;
305305

306306
del_timer_sync(&cx81801_timer);
307307

@@ -313,6 +313,8 @@ static void cx81801_close(struct tty_struct *tty)
313313

314314
v253_ops.close(tty);
315315

316+
dapm = &component->card->dapm;
317+
316318
/* Revert back to default audio input/output constellation */
317319
snd_soc_dapm_mutex_lock(dapm);
318320

0 commit comments

Comments
 (0)