Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a221df6 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

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: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 58c95377
Loading
Loading
Loading
Loading
+6 −14
Original line number Original line Diff line number Diff line
@@ -40,7 +40,6 @@ struct max8998_data {
	struct device		*dev;
	struct device		*dev;
	struct max8998_dev	*iodev;
	struct max8998_dev	*iodev;
	int			num_regulators;
	int			num_regulators;
	struct regulator_dev	**rdev;
	u8                      buck1_vol[4]; /* voltages for selection */
	u8                      buck1_vol[4]; /* voltages for selection */
	u8                      buck2_vol[2];
	u8                      buck2_vol[2];
	unsigned int		buck1_idx; /* index to last changed voltage */
	unsigned int		buck1_idx; /* index to last changed voltage */
@@ -746,10 +745,10 @@ static int max8998_pmic_probe(struct platform_device *pdev)
	struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
	struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
	struct max8998_platform_data *pdata = iodev->pdata;
	struct max8998_platform_data *pdata = iodev->pdata;
	struct regulator_config config = { };
	struct regulator_config config = { };
	struct regulator_dev **rdev;
	struct regulator_dev *rdev;
	struct max8998_data *max8998;
	struct max8998_data *max8998;
	struct i2c_client *i2c;
	struct i2c_client *i2c;
	int i, ret, size;
	int i, ret;
	unsigned int v;
	unsigned int v;


	if (!pdata) {
	if (!pdata) {
@@ -768,12 +767,6 @@ static int max8998_pmic_probe(struct platform_device *pdev)
	if (!max8998)
	if (!max8998)
		return -ENOMEM;
		return -ENOMEM;


	size = sizeof(struct regulator_dev *) * pdata->num_regulators;
	max8998->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
	if (!max8998->rdev)
		return -ENOMEM;

	rdev = max8998->rdev;
	max8998->dev = &pdev->dev;
	max8998->dev = &pdev->dev;
	max8998->iodev = iodev;
	max8998->iodev = iodev;
	max8998->num_regulators = pdata->num_regulators;
	max8998->num_regulators = pdata->num_regulators;
@@ -877,13 +870,12 @@ static int max8998_pmic_probe(struct platform_device *pdev)
		config.init_data = pdata->regulators[i].initdata;
		config.init_data = pdata->regulators[i].initdata;
		config.driver_data = max8998;
		config.driver_data = max8998;


		rdev[i] = devm_regulator_register(&pdev->dev,
		rdev = devm_regulator_register(&pdev->dev, &regulators[index],
						  &regulators[index], &config);
					       &config);
		if (IS_ERR(rdev[i])) {
		if (IS_ERR(rdev)) {
			ret = PTR_ERR(rdev[i]);
			ret = PTR_ERR(rdev);
			dev_err(max8998->dev, "regulator %s init failed (%d)\n",
			dev_err(max8998->dev, "regulator %s init failed (%d)\n",
						regulators[index].name, ret);
						regulators[index].name, ret);
			rdev[i] = NULL;
			return ret;
			return ret;
		}
		}
	}
	}