Commit 95a5b240 authored by Sachin Kamat's avatar Sachin Kamat Committed by Mark Brown

ASoC: wm8400: Use devm_regulator_bulk_get

devm_regulator_bulk_get() is device managed and makes error
handling and code cleanup simpler.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 9489e9dc
...@@ -1373,7 +1373,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) ...@@ -1373,7 +1373,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
codec->control_data = priv->wm8400 = wm8400; codec->control_data = priv->wm8400 = wm8400;
priv->codec = codec; priv->codec = codec;
ret = regulator_bulk_get(wm8400->dev, ret = devm_regulator_bulk_get(wm8400->dev,
ARRAY_SIZE(power), &power[0]); ARRAY_SIZE(power), &power[0]);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to get regulators: %d\n", ret); dev_err(codec->dev, "Failed to get regulators: %d\n", ret);
...@@ -1398,15 +1398,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) ...@@ -1398,15 +1398,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
if (!schedule_work(&priv->work)) { if (!schedule_work(&priv->work))
ret = -EINVAL; return -EINVAL;
goto err_regulator;
}
return 0; return 0;
err_regulator:
regulator_bulk_free(ARRAY_SIZE(power), power);
return ret;
} }
static int wm8400_codec_remove(struct snd_soc_codec *codec) static int wm8400_codec_remove(struct snd_soc_codec *codec)
...@@ -1417,8 +1411,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec) ...@@ -1417,8 +1411,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec)
snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1, snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1,
reg & (~WM8400_CODEC_ENA)); reg & (~WM8400_CODEC_ENA));
regulator_bulk_free(ARRAY_SIZE(power), power);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment