aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8400.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-03 06:41:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-03 16:35:06 -0500
commitb903c0ed2e85155c3a67cfc54117223a61bb483f (patch)
treeb17da253dee77847bb15a60920aba78fcdd6b996 /sound/soc/codecs/wm8400.c
parent0d1fe0d4521436d8af2111045a682c4c8aa1b55d (diff)
ASoC: Convert WM8400 to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8400.c')
-rw-r--r--sound/soc/codecs/wm8400.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 56a7b7256efa..aef7e4dcefdd 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -1383,7 +1383,8 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1383 int ret; 1383 int ret;
1384 u16 reg; 1384 u16 reg;
1385 1385
1386 priv = kzalloc(sizeof(struct wm8400_priv), GFP_KERNEL); 1386 priv = devm_kzalloc(codec->dev, sizeof(struct wm8400_priv),
1387 GFP_KERNEL);
1387 if (priv == NULL) 1388 if (priv == NULL)
1388 return -ENOMEM; 1389 return -ENOMEM;
1389 1390
@@ -1395,7 +1396,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1395 ARRAY_SIZE(power), &power[0]); 1396 ARRAY_SIZE(power), &power[0]);
1396 if (ret != 0) { 1397 if (ret != 0) {
1397 dev_err(codec->dev, "Failed to get regulators: %d\n", ret); 1398 dev_err(codec->dev, "Failed to get regulators: %d\n", ret);
1398 goto err; 1399 return ret;
1399 } 1400 }
1400 1401
1401 INIT_WORK(&priv->work, wm8400_probe_deferred); 1402 INIT_WORK(&priv->work, wm8400_probe_deferred);
@@ -1426,14 +1427,11 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1426 1427
1427err_regulator: 1428err_regulator:
1428 regulator_bulk_free(ARRAY_SIZE(power), power); 1429 regulator_bulk_free(ARRAY_SIZE(power), power);
1429err:
1430 kfree(priv);
1431 return ret; 1430 return ret;
1432} 1431}
1433 1432
1434static int wm8400_codec_remove(struct snd_soc_codec *codec) 1433static int wm8400_codec_remove(struct snd_soc_codec *codec)
1435{ 1434{
1436 struct wm8400_priv *priv = snd_soc_codec_get_drvdata(codec);
1437 u16 reg; 1435 u16 reg;
1438 1436
1439 reg = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1); 1437 reg = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1);
@@ -1441,7 +1439,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec)
1441 reg & (~WM8400_CODEC_ENA)); 1439 reg & (~WM8400_CODEC_ENA));
1442 1440
1443 regulator_bulk_free(ARRAY_SIZE(power), power); 1441 regulator_bulk_free(ARRAY_SIZE(power), power);
1444 kfree(priv);
1445 1442
1446 return 0; 1443 return 0;
1447} 1444}