diff options
author | Zidan Wang <zidan.wang@freescale.com> | 2015-11-27 11:12:30 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@nxp.com> | 2016-01-14 11:02:27 -0600 |
commit | 0ba8d9d49a9b87433fa0d83824f4afa65407144c (patch) | |
tree | 8ac9018f9951c730b0043d6262d01392239952a8 /sound | |
parent | d33ce73c1ff6ca6bd6b7dc0aae02461399d08e24 (diff) |
MLK-11915-04 ASoC: imx-cs42888: init asrc_np to avoid wild pointer and check return value of set_fmt()
init asrc_np to avoid wild pointer and check return value of
set_fmt(). Reported by Coverity.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 4ccc87a93e180e09b6494fd6c6d81b07dc054e9b)
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/imx-cs42888.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sound/soc/fsl/imx-cs42888.c b/sound/soc/fsl/imx-cs42888.c index 15338058445c..681788659cff 100644 --- a/sound/soc/fsl/imx-cs42888.c +++ b/sound/soc/fsl/imx-cs42888.c @@ -48,7 +48,9 @@ static int imx_cs42888_surround_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct imx_priv *priv = &card_priv; + struct device *dev = &priv->pdev->dev; u32 dai_format = 0; + int ret = 0; dai_format = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; @@ -61,12 +63,20 @@ static int imx_cs42888_surround_hw_params(struct snd_pcm_substream *substream, snd_soc_dai_set_sysclk(codec_dai, 0, priv->mclk_freq, SND_SOC_CLOCK_IN); /* set cpu DAI configuration */ - snd_soc_dai_set_fmt(cpu_dai, dai_format); + ret = snd_soc_dai_set_fmt(cpu_dai, dai_format); + if (ret) { + dev_err(dev, "failed to set cpu dai fmt: %d\n", ret); + return ret; + } /* set i.MX active slot mask */ snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, 32); /* set codec DAI configuration */ - snd_soc_dai_set_fmt(codec_dai, dai_format); + ret = snd_soc_dai_set_fmt(codec_dai, dai_format); + if (ret) { + dev_err(dev, "failed to set codec dai fmt: %d\n", ret); + return ret; + } return 0; } @@ -205,7 +215,7 @@ static struct snd_soc_card snd_soc_card_imx_cs42888 = { static int imx_cs42888_probe(struct platform_device *pdev) { struct device_node *esai_np, *codec_np; - struct device_node *asrc_np; + struct device_node *asrc_np = NULL; struct platform_device *esai_pdev; struct platform_device *asrc_pdev = NULL; struct i2c_client *codec_dev; |