This driver is using devm_regulator_register() so we don't need to save the
pointer for cleanup.

Signed-off-by: Axel Lin <axel....@ingics.com>
---
 drivers/regulator/pfuze100-regulator.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/pfuze100-regulator.c 
b/drivers/regulator/pfuze100-regulator.c
index 930eb13..c12cbdf32 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -69,7 +69,6 @@ struct pfuze_chip {
        struct regmap *regmap;
        struct device *dev;
        struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR];
-       struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR];
 };
 
 static const int pfuze100_swbst[] = {
@@ -411,6 +410,7 @@ static int pfuze100_regulator_probe(struct i2c_client 
*client,
        struct pfuze_regulator_platform_data *pdata =
            dev_get_platdata(&client->dev);
        struct regulator_config config = { };
+       struct regulator_dev *rdev;
        int i, ret;
        const struct of_device_id *match;
        u32 regulator_num;
@@ -508,12 +508,11 @@ static int pfuze100_regulator_probe(struct i2c_client 
*client,
                config.of_node = match_of_node(i);
                config.ena_gpio = -EINVAL;
 
-               pfuze_chip->regulators[i] =
-                       devm_regulator_register(&client->dev, desc, &config);
-               if (IS_ERR(pfuze_chip->regulators[i])) {
+               rdev = devm_regulator_register(&client->dev, desc, &config);
+               if (IS_ERR(rdev)) {
                        dev_err(&client->dev, "register regulator%s failed\n",
                                pfuze_regulators[i].desc.name);
-                       return PTR_ERR(pfuze_chip->regulators[i]);
+                       return PTR_ERR(rdev);
                }
        }
 
-- 
1.8.3.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to