Skip to content

Commit

Permalink
regulator: isl6271a: Remove *rdev[3] from struct isl_pmic
Browse files Browse the repository at this point in the history
This driver is using devm_regulator_register, so it's not necessary to
store *rdev[3] in struct isl_pmic. Use a local variable instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jan 28, 2019
1 parent a756766 commit a6e5829
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/regulator/isl6271a-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
/* PMIC details */
struct isl_pmic {
struct i2c_client *client;
struct regulator_dev *rdev[3];
struct mutex mtx;
};

Expand Down Expand Up @@ -109,6 +108,7 @@ static const struct regulator_desc isl_rd[] = {
static int isl6271a_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct regulator_dev *rdev;
struct regulator_config config = { };
struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev);
struct isl_pmic *pmic;
Expand All @@ -133,11 +133,10 @@ static int isl6271a_probe(struct i2c_client *i2c,
config.init_data = NULL;
config.driver_data = pmic;

pmic->rdev[i] = devm_regulator_register(&i2c->dev, &isl_rd[i],
&config);
if (IS_ERR(pmic->rdev[i])) {
rdev = devm_regulator_register(&i2c->dev, &isl_rd[i], &config);
if (IS_ERR(rdev)) {
dev_err(&i2c->dev, "failed to register %s\n", id->name);
return PTR_ERR(pmic->rdev[i]);
return PTR_ERR(rdev);
}
}

Expand Down

0 comments on commit a6e5829

Please sign in to comment.