Commit f2b1ce49 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: twl4030: Convert to use devm_kzalloc

Allocate the private data with devm_kzalloc.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d0b3847b
...@@ -2237,7 +2237,8 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec) ...@@ -2237,7 +2237,8 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
{ {
struct twl4030_priv *twl4030; struct twl4030_priv *twl4030;
twl4030 = kzalloc(sizeof(struct twl4030_priv), GFP_KERNEL); twl4030 = devm_kzalloc(codec->dev, sizeof(struct twl4030_priv),
GFP_KERNEL);
if (twl4030 == NULL) { if (twl4030 == NULL) {
dev_err(codec->dev, "Can not allocate memory\n"); dev_err(codec->dev, "Can not allocate memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -2259,7 +2260,6 @@ static int twl4030_soc_remove(struct snd_soc_codec *codec) ...@@ -2259,7 +2260,6 @@ static int twl4030_soc_remove(struct snd_soc_codec *codec)
/* Reset registers to their chip default before leaving */ /* Reset registers to their chip default before leaving */
twl4030_reset_registers(codec); twl4030_reset_registers(codec);
twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF); twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
kfree(twl4030);
if (pdata && pdata->hs_extmute && gpio_is_valid(pdata->hs_extmute_gpio)) if (pdata && pdata->hs_extmute && gpio_is_valid(pdata->hs_extmute_gpio))
gpio_free(pdata->hs_extmute_gpio); gpio_free(pdata->hs_extmute_gpio);
......
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