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

Commit 000d64a7 authored by Meng Wang's avatar Meng Wang Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm8952: use devm_regulator_get to correct regulator ref



During bootup, probe function will get called multiple times until
sound card is registered. And it calls msm8952_init_wsa_switch_supply
for each probe. If registeration fails, it'll not call
regulator_put to decrease regulator ref. In regulator consumers,
there are multiple sound-msm-vdd-wsa-switch.
Use devm_regulator_get instead of regulator_get to correct regulator
ref.

Change-Id: Ie270d235102f784241e3bf9566b811bbda22e419
Signed-off-by: default avatarMeng Wang <mwang@codeaurora.org>
parent 8ca03863
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -2618,7 +2618,7 @@ int msm8952_init_wsa_switch_supply(struct platform_device *pdev,
		return -ENODEV;
	}

	pdata->wsa_switch_supply.supply = regulator_get(dev,
	pdata->wsa_switch_supply.supply = devm_regulator_get(dev,
			switch_supply_str);
	if (IS_ERR(pdata->wsa_switch_supply.supply)) {
		ret = PTR_ERR(pdata->wsa_switch_supply.supply);
@@ -2641,7 +2641,6 @@ int msm8952_init_wsa_switch_supply(struct platform_device *pdev,
	if (ret) {
		dev_err(dev, "Setting voltage failed for regulator %s err = %d\n",
			switch_supply_str, ret);
		regulator_put(pdata->wsa_switch_supply.supply);
		pdata->wsa_switch_supply.supply = NULL;
		return ret;
	}
@@ -2660,7 +2659,6 @@ int msm8952_init_wsa_switch_supply(struct platform_device *pdev,
	if (ret < 0) {
		dev_err(dev, "Setting current failed for regulator %s err = %d\n",
			switch_supply_str, ret);
		regulator_put(pdata->wsa_switch_supply.supply);
		pdata->wsa_switch_supply.supply = NULL;
		return ret;
	}