regulator: s5m8767: Check pdata->buck[2|3|4]_gpiodvs earlier
authorAxel Lin <axel.lin@gmail.com>
Sat, 10 Mar 2012 00:43:02 +0000 (08:43 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 14 Mar 2012 14:10:30 +0000 (14:10 +0000)
If we need to ensure only one of the buck[2|3|4]_gpiodvs can be specificed,
check them earlier.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/s5m8767.c

index 9d5d9159040f2834e2a15e56856f373676a836f9..611d02d70b6d8ea92c416f0ddc2d52b823bea497 100644 (file)
@@ -547,6 +547,27 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
+       if (pdata->buck2_gpiodvs) {
+               if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) {
+                       dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
+                       return -EINVAL;
+               }
+       }
+
+       if (pdata->buck3_gpiodvs) {
+               if (pdata->buck2_gpiodvs || pdata->buck4_gpiodvs) {
+                       dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
+                       return -EINVAL;
+               }
+       }
+
+       if (pdata->buck4_gpiodvs) {
+               if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs) {
+                       dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
+                       return -EINVAL;
+               }
+       }
+
        s5m8767 = devm_kzalloc(&pdev->dev, sizeof(struct s5m8767_info),
                                GFP_KERNEL);
        if (!s5m8767)
@@ -640,30 +661,6 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
                }
        }
 
-       if (pdata->buck2_gpiodvs) {
-               if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) {
-                       dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
-                       ret = -EINVAL;
-                       return ret;
-               }
-       }
-
-       if (pdata->buck3_gpiodvs) {
-               if (pdata->buck2_gpiodvs || pdata->buck4_gpiodvs) {
-                       dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
-                       ret = -EINVAL;
-                       return ret;
-               }
-       }
-
-       if (pdata->buck4_gpiodvs) {
-               if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs) {
-                       dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n");
-                       ret = -EINVAL;
-                       return ret;
-               }
-       }
-
        s5m_reg_update(s5m8767->iodev, S5M8767_REG_BUCK2CTRL,
                        (pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1), 1 << 1);
        s5m_reg_update(s5m8767->iodev, S5M8767_REG_BUCK3CTRL,