1
0
Fork 0

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)
pull/10/head
Zidan Wang 2015-11-27 11:12:30 +08:00 committed by Jason Liu
parent e2b2fbf5d8
commit 5d4722cd96
1 changed files with 13 additions and 3 deletions

View File

@ -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;