Skip to content

Commit

Permalink
regulator: tps6586x: Remove unnecessary rdev[] array
Browse files Browse the repository at this point in the history
Now we are using devm_regulator_register(), so we don't need the rdev[] array
to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 13, 2014
1 parent 02e9058 commit d6fe2c7
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions drivers/regulator/tps6586x-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
{
struct tps6586x_regulator *ri = NULL;
struct regulator_config config = { };
struct regulator_dev **rdev;
struct regulator_dev *rdev;
struct regulator_init_data *reg_data;
struct tps6586x_platform_data *pdata;
struct of_regulator_match *tps6586x_reg_matches = NULL;
Expand All @@ -416,11 +416,6 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
return -ENODEV;
}

rdev = devm_kzalloc(&pdev->dev, TPS6586X_ID_MAX_REGULATOR *
sizeof(*rdev), GFP_KERNEL);
if (!rdev)
return -ENOMEM;

version = tps6586x_get_version(pdev->dev.parent);

for (id = 0; id < TPS6586X_ID_MAX_REGULATOR; ++id) {
Expand All @@ -447,12 +442,11 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
if (tps6586x_reg_matches)
config.of_node = tps6586x_reg_matches[id].of_node;

rdev[id] = devm_regulator_register(&pdev->dev, &ri->desc,
&config);
if (IS_ERR(rdev[id])) {
rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "failed to register regulator %s\n",
ri->desc.name);
return PTR_ERR(rdev[id]);
return PTR_ERR(rdev);
}

if (reg_data) {
Expand Down

0 comments on commit d6fe2c7

Please sign in to comment.