aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/cs4270.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index fef0f48330e4..055536645da9 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -671,7 +671,8 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
671 i2c_client->addr); 671 i2c_client->addr);
672 dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF); 672 dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF);
673 673
674 cs4270 = kzalloc(sizeof(struct cs4270_private), GFP_KERNEL); 674 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private),
675 GFP_KERNEL);
675 if (!cs4270) { 676 if (!cs4270) {
676 dev_err(&i2c_client->dev, "could not allocate codec\n"); 677 dev_err(&i2c_client->dev, "could not allocate codec\n");
677 return -ENOMEM; 678 return -ENOMEM;
@@ -682,8 +683,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
682 683
683 ret = snd_soc_register_codec(&i2c_client->dev, 684 ret = snd_soc_register_codec(&i2c_client->dev,
684 &soc_codec_device_cs4270, &cs4270_dai, 1); 685 &soc_codec_device_cs4270, &cs4270_dai, 1);
685 if (ret < 0)
686 kfree(cs4270);
687 return ret; 686 return ret;
688} 687}
689 688
@@ -696,7 +695,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
696static int cs4270_i2c_remove(struct i2c_client *i2c_client) 695static int cs4270_i2c_remove(struct i2c_client *i2c_client)
697{ 696{
698 snd_soc_unregister_codec(&i2c_client->dev); 697 snd_soc_unregister_codec(&i2c_client->dev);
699 kfree(i2c_get_clientdata(i2c_client));
700 return 0; 698 return 0;
701} 699}
702 700