]> Git Repo - linux.git/commitdiff
regulator: s5m8767: Prevent possible NULL pointer dereference
authorAxel Lin <[email protected]>
Wed, 13 Feb 2013 01:31:31 +0000 (09:31 +0800)
committerMark Brown <[email protected]>
Wed, 13 Feb 2013 12:52:19 +0000 (12:52 +0000)
s5m8767_pmic_dt_parse_pdata dereferenes pdata, thus check pdata earlier to
avoid NULL pointer dereference.

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
drivers/regulator/s5m8767.c

index ef0532d56d439f5b10f3b30eeee59b9b626d667a..8a831947c351152bb52b886d81eef232eb5794c6 100644 (file)
@@ -659,17 +659,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
        struct s5m8767_info *s5m8767;
        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) {
                ret = s5m8767_pmic_dt_parse_pdata(pdev, pdata);
                if (ret)
                        return ret;
        }
 
-       if (!pdata) {
-               dev_err(pdev->dev.parent, "Platform data not supplied\n");
-               return -ENODEV;
-       }
-
        if (pdata->buck2_gpiodvs) {
                if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) {
                        dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
This page took 0.059043 seconds and 4 git commands to generate.