diff options
author | Fabio Estevam <festevam@gmail.com> | 2011-12-28 08:30:11 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-28 12:20:20 -0500 |
commit | 512fa7c40b9e808000eac31458668369e131a243 (patch) | |
tree | 9a9d6cab181b501f1bd028b9c06a2893893db751 /sound/soc/codecs/sgtl5000.c | |
parent | cf1ee98d800459e6f055742f84355b1aa9e937ae (diff) |
ASoC: Convert sgtl5000 to use devm_kzalloc()
Convert sgtl5000 codec driver to use devm_kzalloc().
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/sgtl5000.c')
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 14 |
1 files changed, 3 insertions, 11 deletions
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, | |||
1401 | struct sgtl5000_priv *sgtl5000; | 1401 | struct sgtl5000_priv *sgtl5000; |
1402 | int ret; | 1402 | int ret; |
1403 | 1403 | ||
1404 | sgtl5000 = kzalloc(sizeof(struct sgtl5000_priv), GFP_KERNEL); | 1404 | sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv), |
1405 | GFP_KERNEL); | ||
1405 | if (!sgtl5000) | 1406 | if (!sgtl5000) |
1406 | return -ENOMEM; | 1407 | return -ENOMEM; |
1407 | 1408 | ||
@@ -1409,22 +1410,13 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, | |||
1409 | 1410 | ||
1410 | ret = snd_soc_register_codec(&client->dev, | 1411 | ret = snd_soc_register_codec(&client->dev, |
1411 | &sgtl5000_driver, &sgtl5000_dai, 1); | 1412 | &sgtl5000_driver, &sgtl5000_dai, 1); |
1412 | if (ret) { | 1413 | return ret; |
1413 | dev_err(&client->dev, "Failed to register codec: %d\n", ret); | ||
1414 | kfree(sgtl5000); | ||
1415 | return ret; | ||
1416 | } | ||
1417 | |||
1418 | return 0; | ||
1419 | } | 1414 | } |
1420 | 1415 | ||
1421 | static __devexit int sgtl5000_i2c_remove(struct i2c_client *client) | 1416 | static __devexit int sgtl5000_i2c_remove(struct i2c_client *client) |
1422 | { | 1417 | { |
1423 | struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client); | ||
1424 | |||
1425 | snd_soc_unregister_codec(&client->dev); | 1418 | snd_soc_unregister_codec(&client->dev); |
1426 | 1419 | ||
1427 | kfree(sgtl5000); | ||
1428 | return 0; | 1420 | return 0; |
1429 | } | 1421 | } |
1430 | 1422 | ||