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>
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",
regmap_exit(chip->regmap_companion);
i2c_unregister_device(chip->companion);
}
- regmap_exit(chip->regmap);
kfree(chip);
return 0;
}