Commit 8a221df6996f296aba4d4d713a42799bb28fde69

Authored by Axel Lin
Committed by Mark Brown
1 parent 58c9537791

regulator: max8998: Remove unnecessary **rdev from struct max8998_data

Now we are using devm_regulator_register(), so we don't need to allocate *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>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

Showing 1 changed file with 6 additions and 14 deletions Side-by-side Diff

drivers/regulator/max8998.c
... ... @@ -40,7 +40,6 @@
40 40 struct device *dev;
41 41 struct max8998_dev *iodev;
42 42 int num_regulators;
43   - struct regulator_dev **rdev;
44 43 u8 buck1_vol[4]; /* voltages for selection */
45 44 u8 buck2_vol[2];
46 45 unsigned int buck1_idx; /* index to last changed voltage */
47 46  
... ... @@ -746,10 +745,10 @@
746 745 struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
747 746 struct max8998_platform_data *pdata = iodev->pdata;
748 747 struct regulator_config config = { };
749   - struct regulator_dev **rdev;
  748 + struct regulator_dev *rdev;
750 749 struct max8998_data *max8998;
751 750 struct i2c_client *i2c;
752   - int i, ret, size;
  751 + int i, ret;
753 752 unsigned int v;
754 753  
755 754 if (!pdata) {
... ... @@ -768,12 +767,6 @@
768 767 if (!max8998)
769 768 return -ENOMEM;
770 769  
771   - size = sizeof(struct regulator_dev *) * pdata->num_regulators;
772   - max8998->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
773   - if (!max8998->rdev)
774   - return -ENOMEM;
775   -
776   - rdev = max8998->rdev;
777 770 max8998->dev = &pdev->dev;
778 771 max8998->iodev = iodev;
779 772 max8998->num_regulators = pdata->num_regulators;
780 773  
... ... @@ -877,13 +870,12 @@
877 870 config.init_data = pdata->regulators[i].initdata;
878 871 config.driver_data = max8998;
879 872  
880   - rdev[i] = devm_regulator_register(&pdev->dev,
881   - &regulators[index], &config);
882   - if (IS_ERR(rdev[i])) {
883   - ret = PTR_ERR(rdev[i]);
  873 + rdev = devm_regulator_register(&pdev->dev, &regulators[index],
  874 + &config);
  875 + if (IS_ERR(rdev)) {
  876 + ret = PTR_ERR(rdev);
884 877 dev_err(max8998->dev, "regulator %s init failed (%d)\n",
885 878 regulators[index].name, ret);
886   - rdev[i] = NULL;
887 879 return ret;
888 880 }
889 881 }