regulator/ab8500: move dereference below the check for NULL
authorDan Carpenter <error27@gmail.com>
Sat, 14 Aug 2010 09:03:16 +0000 (11:03 +0200)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Wed, 1 Sep 2010 11:59:33 +0000 (12:59 +0100)
I moved the dereference of "ab8500" below the check for NULL.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/ab8500.c

index dc3f1a491675abe371a483f862b01b60d1489a47..cc7cbafc5b9482e31e0bb3f68ea4345e10e6d1f1 100644 (file)
@@ -344,13 +344,14 @@ static inline struct ab8500_regulator_info *find_regulator_info(int id)
 static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
 {
        struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
-       struct ab8500_platform_data *pdata = dev_get_platdata(ab8500->dev);
+       struct ab8500_platform_data *pdata;
        int i, err;
 
        if (!ab8500) {
                dev_err(&pdev->dev, "null mfd parent\n");
                return -EINVAL;
        }
+       pdata = dev_get_platdata(ab8500->dev);
 
        /* register all regulators */
        for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) {