Skip to content

Commit e81d7bc

Browse files
AxelLinbroonie
authored andcommitted
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: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1 parent cbb0ed4 commit e81d7bc

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎drivers/regulator/s5m8767.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -659,17 +659,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
659659
struct s5m8767_info *s5m8767;
660660
int i, ret, size, buck_init;
661661

662+
if (!pdata) {
663+
dev_err(pdev->dev.parent, "Platform data not supplied\n");
664+
return -ENODEV;
665+
}
666+
662667
if (iodev->dev->of_node) {
663668
ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata);
664669
if (ret)
665670
return ret;
666671
}
667672

668-
if (!pdata) {
669-
dev_err(pdev->dev.parent, "Platform data not supplied\n");
670-
return -ENODEV;
671-
}
672-
673673
if (pdata->buck2_gpiodvs) {
674674
if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) {
675675
dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");

0 commit comments

Comments
 (0)