aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-28 23:00:13 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-02 07:28:11 -0500
commit021b918efb204b1deda7cfc7edef2972d98ffc46 (patch)
tree1f61880293d8ab7d438fb33b39f4a459fefdbce5 /sound/soc/codecs
parent24b6f263d97cd2f1f2d579021af97fcd1d632a98 (diff)
ASoC: Convert cs42l51 to devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/cs42l51.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index ffce9f2a6643..a8bf588e8740 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -577,7 +577,8 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c_client,
577 dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n", 577 dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n",
578 ret & 7); 578 ret & 7);
579 579
580 cs42l51 = kzalloc(sizeof(struct cs42l51_private), GFP_KERNEL); 580 cs42l51 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l51_private),
581 GFP_KERNEL);
581 if (!cs42l51) { 582 if (!cs42l51) {
582 dev_err(&i2c_client->dev, "could not allocate codec\n"); 583 dev_err(&i2c_client->dev, "could not allocate codec\n");
583 return -ENOMEM; 584 return -ENOMEM;
@@ -588,18 +589,13 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c_client,
588 589
589 ret = snd_soc_register_codec(&i2c_client->dev, 590 ret = snd_soc_register_codec(&i2c_client->dev,
590 &soc_codec_device_cs42l51, &cs42l51_dai, 1); 591 &soc_codec_device_cs42l51, &cs42l51_dai, 1);
591 if (ret < 0)
592 kfree(cs42l51);
593error: 592error:
594 return ret; 593 return ret;
595} 594}
596 595
597static int cs42l51_i2c_remove(struct i2c_client *client) 596static int cs42l51_i2c_remove(struct i2c_client *client)
598{ 597{
599 struct cs42l51_private *cs42l51 = i2c_get_clientdata(client);
600
601 snd_soc_unregister_codec(&client->dev); 598 snd_soc_unregister_codec(&client->dev);
602 kfree(cs42l51);
603 return 0; 599 return 0;
604} 600}
605 601