[alsa-devel] [PATCH] ASoC: Use devm_kzalloc() in wm5100

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Nov 24 19:04:30 CET 2011


Signed-off-by: Mark Brown <broonie at opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm5100.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 46aca14..a9d5ac0 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -2743,7 +2743,8 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
 	unsigned int reg;
 	int ret, i;
 
-	wm5100 = kzalloc(sizeof(struct wm5100_priv), GFP_KERNEL);
+	wm5100 = devm_kzalloc(&i2c->dev, sizeof(struct wm5100_priv),
+			      GFP_KERNEL);
 	if (wm5100 == NULL)
 		return -ENOMEM;
 
@@ -2752,7 +2753,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
 		ret = PTR_ERR(wm5100->regmap);
 		dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
 			ret);
-		goto err_alloc;
+		goto err;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++)
@@ -2910,8 +2911,7 @@ err_core:
 			    wm5100->core_supplies);
 err_regmap:
 	regmap_exit(wm5100->regmap);
-err_alloc:
-	kfree(wm5100);
+err:
 	return ret;
 }
 
-- 
1.7.7.3



More information about the Alsa-devel mailing list