summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaojun Sang <xsang@codeaurora.org>2016-09-20 16:22:49 +0800
committerXiaojun Sang <xsang@codeaurora.org>2016-09-23 00:06:45 +0800
commit17d98dbde125ffb11511673105ac2d1fd2a9d826 (patch)
tree7a84a5a6dd45ba384a2bc9f98e84ef2025dec957
parent4e2a8a0fa1c78712904312e13ef33d02be78d421 (diff)
ASoC: wcd: add null check before pointer dereference
Slimbus device pointer may be null, which may lead to null pointer dereference. CRs-Fixed: 1054973 Signed-off-by: Xiaojun Sang <xsang@codeaurora.org> Change-Id: Ica22ee19f281fa0cff7d629f396c41c935692c59
-rw-r--r--drivers/mfd/wcd9xxx-core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mfd/wcd9xxx-core.c b/drivers/mfd/wcd9xxx-core.c
index 981d372277ee..5bcd0db929b3 100644
--- a/drivers/mfd/wcd9xxx-core.c
+++ b/drivers/mfd/wcd9xxx-core.c
@@ -1219,6 +1219,11 @@ static int wcd9xxx_slim_probe(struct slim_device *slim)
intf_type = wcd9xxx_get_intf_type();
+ if (!slim) {
+ ret = -EINVAL;
+ goto err;
+ }
+
if (intf_type == WCD9XXX_INTERFACE_TYPE_I2C) {
dev_dbg(&slim->dev, "%s:Codec is detected in I2C mode\n",
__func__);