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