regulator: twl: use devm_regulator_register()
authorJingoo Han <jg1.han@samsung.com>
Mon, 30 Sep 2013 00:59:04 +0000 (09:59 +0900)
committerMark Brown <broonie@linaro.org>
Mon, 30 Sep 2013 17:11:03 +0000 (18:11 +0100)
Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/twl-regulator.c

index 78aae4cbb00424864fbad430fc55379a060065c5..8ebd785485c73ddceba4047facf3960192a2cdf2 100644 (file)
@@ -1188,7 +1188,7 @@ static int twlreg_probe(struct platform_device *pdev)
        config.driver_data = info;
        config.of_node = pdev->dev.of_node;
 
-       rdev = regulator_register(&info->desc, &config);
+       rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
        if (IS_ERR(rdev)) {
                dev_err(&pdev->dev, "can't register %s, %ld\n",
                                info->desc.name, PTR_ERR(rdev));
@@ -1217,7 +1217,6 @@ static int twlreg_remove(struct platform_device *pdev)
        struct regulator_dev *rdev = platform_get_drvdata(pdev);
        struct twlreg_info *info = rdev->reg_data;
 
-       regulator_unregister(rdev);
        kfree(info);
        return 0;
 }