From: Fabio Estevam Date: Wed, 28 Dec 2011 13:30:11 +0000 (-0200) Subject: ASoC: Convert sgtl5000 to use devm_kzalloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=512fa7c40b9e808000eac31458668369e131a243;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git ASoC: Convert sgtl5000 to use devm_kzalloc() Convert sgtl5000 codec driver to use devm_kzalloc(). Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 827a43bec531..fc9b127206e2 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1401,7 +1401,8 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, struct sgtl5000_priv *sgtl5000; int ret; - sgtl5000 = kzalloc(sizeof(struct sgtl5000_priv), GFP_KERNEL); + sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv), + GFP_KERNEL); if (!sgtl5000) return -ENOMEM; @@ -1409,22 +1410,13 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, ret = snd_soc_register_codec(&client->dev, &sgtl5000_driver, &sgtl5000_dai, 1); - if (ret) { - dev_err(&client->dev, "Failed to register codec: %d\n", ret); - kfree(sgtl5000); - return ret; - } - - return 0; + return ret; } static __devexit int sgtl5000_i2c_remove(struct i2c_client *client) { - struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - kfree(sgtl5000); return 0; }