aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshailendra.v@samsung.com <shailendra.v@samsung.com>2017-01-27 06:17:48 -0500
committerMatthias Brugger <matthias.bgg@gmail.com>2017-05-15 04:47:25 -0400
commit58a823dd7b515827ed07adb268e1769b3c292586 (patch)
tree3eceb889b0c132363717ef403777567c7fad7382
parentf282693f808723b6593db34c47fa0e17cb52586f (diff)
soc: mediatek: PMIC wrap: Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
-rw-r--r--drivers/soc/mediatek/mtk-pmic-wrap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 285b434449a6..c80a04e1b2b1 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -1117,6 +1117,11 @@ static int pwrap_probe(struct platform_device *pdev)
1117 const struct of_device_id *of_slave_id = NULL; 1117 const struct of_device_id *of_slave_id = NULL;
1118 struct resource *res; 1118 struct resource *res;
1119 1119
1120 if (!of_id) {
1121 dev_err(&pdev->dev, "Error: No device match found\n");
1122 return -ENODEV;
1123 }
1124
1120 if (pdev->dev.of_node->child) 1125 if (pdev->dev.of_node->child)
1121 of_slave_id = of_match_node(of_slave_match_tbl, 1126 of_slave_id = of_match_node(of_slave_match_tbl,
1122 pdev->dev.of_node->child); 1127 pdev->dev.of_node->child);