Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: max8997: Remove unnecessary **rdev from struct max8997_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>

authored by

Axel Lin and committed by
Mark Brown
ad78bba4 f0d5c73a

+6 -13
+6 -13
drivers/regulator/max8997.c
··· 38 38 struct device *dev; 39 39 struct max8997_dev *iodev; 40 40 int num_regulators; 41 - struct regulator_dev **rdev; 42 41 int ramp_delay; /* in mV/us */ 43 42 44 43 bool buck1_gpiodvs; ··· 1028 1029 struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); 1029 1030 struct max8997_platform_data *pdata = iodev->pdata; 1030 1031 struct regulator_config config = { }; 1031 - struct regulator_dev **rdev; 1032 + struct regulator_dev *rdev; 1032 1033 struct max8997_data *max8997; 1033 1034 struct i2c_client *i2c; 1034 - int i, ret, size, nr_dvs; 1035 + int i, ret, nr_dvs; 1035 1036 u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; 1036 1037 1037 1038 if (!pdata) { ··· 1050 1051 if (!max8997) 1051 1052 return -ENOMEM; 1052 1053 1053 - size = sizeof(struct regulator_dev *) * pdata->num_regulators; 1054 - max8997->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); 1055 - if (!max8997->rdev) 1056 - return -ENOMEM; 1057 - 1058 - rdev = max8997->rdev; 1059 1054 max8997->dev = &pdev->dev; 1060 1055 max8997->iodev = iodev; 1061 1056 max8997->num_regulators = pdata->num_regulators; ··· 1197 1204 config.driver_data = max8997; 1198 1205 config.of_node = pdata->regulators[i].reg_node; 1199 1206 1200 - rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id], 1201 - &config); 1202 - if (IS_ERR(rdev[i])) { 1207 + rdev = devm_regulator_register(&pdev->dev, &regulators[id], 1208 + &config); 1209 + if (IS_ERR(rdev)) { 1203 1210 dev_err(max8997->dev, "regulator init failed for %d\n", 1204 1211 id); 1205 - return PTR_ERR(rdev[i]); 1212 + return PTR_ERR(rdev); 1206 1213 } 1207 1214 } 1208 1215