summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolin Chen <Guangyu.Chen@freescale.com>2014-04-18 14:12:34 +0800
committerNicolin Chen <Guangyu.Chen@freescale.com>2014-04-18 14:27:31 +0800
commitb8297f9f09dacb90f0363aa9d8dc7a6e4c8984ea (patch)
tree94aef7ffe5887b7f6691b59dbf488fd779f7246a
parent030e6f92048b2729f8b3b71ab070e8a3a4d30d5d (diff)
ENGR00309297-1 ASoC: imx-cs42888: Error out if failed to get p2p params
There's a possiblity that ASRC P2P would error out during its probe() due to missing some DT bindings for example. If that happens, this asrc_p2p would be a NULL pointer and accessing it would cause Kernel Panic. Thus this patch adds an error out here to keep it safe. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> (cherry picked from commit cc678a578ef873127b8237680282f1cd55fe1873)
-rw-r--r--sound/soc/fsl/imx-cs42888.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-cs42888.c b/sound/soc/fsl/imx-cs42888.c
index db9f58d89868..a56f4f1984ed 100644
--- a/sound/soc/fsl/imx-cs42888.c
+++ b/sound/soc/fsl/imx-cs42888.c
@@ -247,6 +247,11 @@ static int imx_cs42888_probe(struct platform_device *pdev)
if (asrc_pdev) {
struct fsl_asrc_p2p *asrc_p2p;
asrc_p2p = platform_get_drvdata(asrc_pdev);
+ if (!asrc_p2p) {
+ dev_err(&pdev->dev, "failed to get p2p params\n");
+ ret = -EINVAL;
+ goto fail;
+ }
asrc_p2p->per_dev = ESAI;
priv->fe_p2p_rate = asrc_p2p->p2p_rate;
priv->fe_p2p_width = asrc_p2p->p2p_width;