From dc0e01a87c0e6360e0b63f664f337d74c4e2fe44 Mon Sep 17 00:00:00 2001 From: Shuai Li Date: Sat, 19 Oct 2019 17:49:10 +0800 Subject: [PATCH] audio: coveriy fix [1/1] PD#SWPL-14015 Problem: Coverity defect cleanup. Solution: Coverity defect cleanup. Verify: SM1 Change-Id: I5d564ddafb4105b80c0243efafa6fe141fd59be7 Signed-off-by: Shuai Li --- sound/soc/amlogic/auge/tdm.c | 8 ++++---- sound/soc/amlogic/meson/pcm.c | 2 ++ sound/soc/amlogic/meson/pcm_dai.c | 9 +++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 98b8a368ed46..5fadee2e5ef6 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -1694,11 +1694,11 @@ static int aml_tdm_platform_suspend(struct platform_device *pdev, /*mute default clk */ if (p_tdm->start_clk_enable == 1 && p_tdm->pin_ctl) { - struct pinctrl_state *state = NULL; + struct pinctrl_state *ps = NULL; - state = pinctrl_lookup_state(p_tdm->pin_ctl, "tdmout_a_gpio"); - if (!IS_ERR_OR_NULL(state)) { - pinctrl_select_state(p_tdm->pin_ctl, state); + ps = pinctrl_lookup_state(p_tdm->pin_ctl, "tdmout_a_gpio"); + if (!IS_ERR_OR_NULL(ps)) { + pinctrl_select_state(p_tdm->pin_ctl, ps); pr_info("%s tdm pins disable!\n", __func__); } } diff --git a/sound/soc/amlogic/meson/pcm.c b/sound/soc/amlogic/meson/pcm.c index 89df53d12706..489f082f33d7 100644 --- a/sound/soc/amlogic/meson/pcm.c +++ b/sound/soc/amlogic/meson/pcm.c @@ -242,7 +242,9 @@ static int aml_pcm_timer_create(struct snd_pcm_substream *substream) prtd->timer_period = 1; prtd->timer.data = (unsigned long)substream; prtd->timer.function = aml_pcm_timer_callback; + spin_lock(&prtd->lock); prtd->running = 0; + spin_unlock(&prtd->lock); return 0; } diff --git a/sound/soc/amlogic/meson/pcm_dai.c b/sound/soc/amlogic/meson/pcm_dai.c index 9f09273c5904..248a720f4202 100644 --- a/sound/soc/amlogic/meson/pcm_dai.c +++ b/sound/soc/amlogic/meson/pcm_dai.c @@ -145,12 +145,17 @@ static int aml_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd, { struct aml_pcm *pcm_p = dev_get_drvdata(dai->dev); + if (!pcm_p) { + pr_err("%s(), null ptr\n", __func__); + return -EINVAL; + } + switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* TODO */ - if (pcm_p && pcm_p->pcm_mode) { + if (pcm_p->pcm_mode) { pr_info("aiu pcm master stream %d enable\n\n", substream->stream); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) @@ -169,7 +174,7 @@ static int aml_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - if (pcm_p && pcm_p->pcm_mode) { + if (pcm_p->pcm_mode) { pr_info("aiu master pcm stream %d disable\n\n", substream->stream); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)