aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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