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

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>

authored by

Axel Lin and committed by
Mark Brown
8a221df6 58c95377

+6 -14
+6 -14
drivers/regulator/max8998.c
··· 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 */ ··· 745 746 struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); 746 747 struct max8998_platform_data *pdata = iodev->pdata; 747 748 struct regulator_config config = { }; 748 - struct regulator_dev **rdev; 749 + struct regulator_dev *rdev; 749 750 struct max8998_data *max8998; 750 751 struct i2c_client *i2c; 751 - int i, ret, size; 752 + int i, ret; 752 753 unsigned int v; 753 754 754 755 if (!pdata) { ··· 767 768 if (!max8998) 768 769 return -ENOMEM; 769 770 770 - size = sizeof(struct regulator_dev *) * pdata->num_regulators; 771 - max8998->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); 772 - if (!max8998->rdev) 773 - return -ENOMEM; 774 - 775 - rdev = max8998->rdev; 776 771 max8998->dev = &pdev->dev; 777 772 max8998->iodev = iodev; 778 773 max8998->num_regulators = pdata->num_regulators; ··· 870 877 config.init_data = pdata->regulators[i].initdata; 871 878 config.driver_data = max8998; 872 879 873 - rdev[i] = devm_regulator_register(&pdev->dev, 874 - &regulators[index], &config); 875 - if (IS_ERR(rdev[i])) { 876 - ret = PTR_ERR(rdev[i]); 880 + rdev = devm_regulator_register(&pdev->dev, &regulators[index], 881 + &config); 882 + if (IS_ERR(rdev)) { 883 + ret = PTR_ERR(rdev); 877 884 dev_err(max8998->dev, "regulator %s init failed (%d)\n", 878 885 regulators[index].name, ret); 879 - rdev[i] = NULL; 880 886 return ret; 881 887 } 882 888 }