ASoC: Intel: Skylake: Fix to fail safely if module not available in path
diff mbox

Message ID 1482218205-1067-1-git-send-email-subhransu.s.prusty@intel.com
State Accepted
Commit 91ce54978ccece323aa6df930249ff84a7d233c7
Headers show

Commit Message

Subhransu S. Prusty Dec. 20, 2016, 7:16 a.m. UTC
From: G Kranthi <gudishax.kranthikumar@intel.com>

If a module is not available in a pipeline, fail safely rather than
causing oops.

Signed-off-by: G Kranthi <gudishax.kranthikumar@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 10fa10d..7e97ae6 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -254,6 +254,9 @@  static int skl_pcm_open(struct snd_pcm_substream *substream,
 	snd_pcm_set_sync(substream);
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
+	if (!mconfig)
+		return -EINVAL;
+
 	skl_tplg_d0i3_get(skl, mconfig->d0i3_caps);
 
 	return 0;