Commit e81d7bc8 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: s5m8767: Prevent possible NULL pointer dereference

s5m8767_pmic_dt_parse_pdata dereferenes pdata, thus check pdata earlier to
avoid NULL pointer dereference.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent cbb0ed49
...@@ -659,17 +659,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -659,17 +659,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
struct s5m8767_info *s5m8767; struct s5m8767_info *s5m8767;
int i, ret, size, buck_init; int i, ret, size, buck_init;
if (!pdata) {
dev_err(pdev->dev.parent, "Platform data not supplied\n");
return -ENODEV;
}
if (iodev->dev->of_node) { if (iodev->dev->of_node) {
ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata); ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata);
if (ret) if (ret)
return ret; return ret;
} }
if (!pdata) {
dev_err(pdev->dev.parent, "Platform data not supplied\n");
return -ENODEV;
}
if (pdata->buck2_gpiodvs) { if (pdata->buck2_gpiodvs) {
if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) { if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) {
dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n"); dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment