summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-11-27 10:53:09 +0800
committerNitin Garg <nitin.garg@nxp.com>2016-01-14 11:02:26 -0600
commitcdf937daa23cf5d0b0a3a90265f7d220b5e59522 (patch)
tree01dc36b7bd04308227f732b974def59870b6af1f /sound
parentd7686f21e2d81586f389fb28901ef6fd66ee6833 (diff)
MLK-11915-01 ASoC: imx-wm8960: check return value and init codec_np to avoid wild pointer
check return value for set_fmt and set_sysclk function, and init codec_np to avoid wild pointer. Reported by coverity. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> (cherry picked from commit 68021ab9ada4a7f3037993a3887453e12271d4ed)
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-wm8960.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/fsl/imx-wm8960.c b/sound/soc/fsl/imx-wm8960.c
index a1314f9a15c2..c12f5bea733c 100644
--- a/sound/soc/fsl/imx-wm8960.c
+++ b/sound/soc/fsl/imx-wm8960.c
@@ -311,13 +311,17 @@ static int imx_hifi_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_card *card = rtd->card;
struct imx_wm8960_data *data = snd_soc_card_get_drvdata(card);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+ struct device *dev = card->dev;
+ int ret;
data->is_stream_in_use[tx] = false;
/* Power down PLL to save power*/
if (data->is_codec_master && !data->is_stream_in_use[!tx]) {
snd_soc_dai_set_pll(codec_dai, 0, 0, 0, 0);
- snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF);
+ ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF);
+ if (ret)
+ dev_warn(dev, "failed to set codec dai fmt: %d\n", ret);
}
return 0;
@@ -450,7 +454,8 @@ static struct snd_soc_dai_link imx_wm8960_dai[] = {
static int imx_wm8960_probe(struct platform_device *pdev)
{
- struct device_node *cpu_np, *codec_np, *gpr_np;
+ struct device_node *cpu_np, *codec_np = NULL;
+ struct device_node *gpr_np;
struct platform_device *cpu_pdev;
struct imx_priv *priv = &card_priv;
struct i2c_client *codec_dev;