mfd: 88pm860x: Use devm_regmap_init_i2c()
authorSachin Kamat <sachin.kamat@linaro.org>
Wed, 12 Jun 2013 08:25:43 +0000 (13:55 +0530)
committerLee Jones <lee.jones@linaro.org>
Thu, 13 Jun 2013 10:02:21 +0000 (11:02 +0100)
devm_regmap_init_i2c() is device managed and makes cleanup simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/88pm860x-core.c

index 31ca555..629d640 100644 (file)
@@ -1155,7 +1155,7 @@ static int pm860x_probe(struct i2c_client *client,
                return -ENOMEM;
 
        chip->id = verify_addr(client);
-       chip->regmap = regmap_init_i2c(client, &pm860x_regmap_config);
+       chip->regmap = devm_regmap_init_i2c(client, &pm860x_regmap_config);
        if (IS_ERR(chip->regmap)) {
                ret = PTR_ERR(chip->regmap);
                dev_err(&client->dev, "Failed to allocate register map: %d\n",
@@ -1203,7 +1203,6 @@ static int pm860x_remove(struct i2c_client *client)
                regmap_exit(chip->regmap_companion);
                i2c_unregister_device(chip->companion);
        }
-       regmap_exit(chip->regmap);
        kfree(chip);
        return 0;
 }