audio: coveriy fix [1/1]
authorShuai Li <shuai.li@amlogic.com>
Sat, 19 Oct 2019 09:49:10 +0000 (17:49 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 21 Oct 2019 03:25:52 +0000 (20:25 -0700)
PD#SWPL-14015

Problem:
Coverity defect cleanup.

Solution:
Coverity defect cleanup.

Verify:
SM1

Change-Id: I5d564ddafb4105b80c0243efafa6fe141fd59be7
Signed-off-by: Shuai Li <shuai.li@amlogic.com>
sound/soc/amlogic/auge/tdm.c
sound/soc/amlogic/meson/pcm.c
sound/soc/amlogic/meson/pcm_dai.c
sound/soc/codecs/amlogic/tas5805.c

index 3e3c051..57eec3d 100644 (file)
@@ -1786,11 +1786,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__);
                }
        }
index 89df53d..489f082 100644 (file)
@@ -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;
 }
index 9f09273..248a720 100644 (file)
@@ -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)
index c83af1e..7264b59 100644 (file)
@@ -1087,17 +1087,12 @@ static int tas5805m_probe(struct snd_soc_codec *codec)
        int ret;
        struct tas5805m_priv *tas5805m = snd_soc_codec_get_drvdata(codec);
 
-//     ret =
-//         regmap_register_patch(tas5805m->regmap, tas5805m_init_sequence,
-//                               ARRAY_SIZE(tas5805m_init_sequence));
        usleep_range(20 * 1000, 21 * 1000);
        ret = tas5805m_reg_init(codec);
        if (ret != 0)
                goto err;
 
-       if (tas5805m)
-               tas5805m_set_volume(codec, tas5805m->vol);
-
+       tas5805m_set_volume(codec, tas5805m->vol);
        snd_soc_add_codec_controls(codec, tas5805m_vol_control,
                        ARRAY_SIZE(tas5805m_vol_control));
        tas5805m->codec = codec;