aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/wm8731.c11
-rw-r--r--sound/soc/codecs/wm8750.c12
2 files changed, 6 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index e6b990507df2..7ca0b5268289 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -543,14 +543,10 @@ static int wm8731_init(struct snd_soc_device *socdev)
543 codec->dapm_event = wm8731_dapm_event; 543 codec->dapm_event = wm8731_dapm_event;
544 codec->dai = &wm8731_dai; 544 codec->dai = &wm8731_dai;
545 codec->num_dai = 1; 545 codec->num_dai = 1;
546 codec->reg_cache_size = ARRAY_SIZE(wm8731_reg); 546 codec->reg_cache_size = sizeof(wm8731_reg);
547 codec->reg_cache = 547 codec->reg_cache = kmemdup(wm8731_reg, sizeof(wm8731_reg), GFP_KERNEL);
548 kzalloc(sizeof(u16) * ARRAY_SIZE(wm8731_reg), GFP_KERNEL);
549 if (codec->reg_cache == NULL) 548 if (codec->reg_cache == NULL)
550 return -ENOMEM; 549 return -ENOMEM;
551 memcpy(codec->reg_cache,
552 wm8731_reg, sizeof(u16) * ARRAY_SIZE(wm8731_reg));
553 codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm8731_reg);
554 550
555 wm8731_reset(codec); 551 wm8731_reset(codec);
556 552
@@ -627,12 +623,11 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind)
627 client_template.adapter = adap; 623 client_template.adapter = adap;
628 client_template.addr = addr; 624 client_template.addr = addr;
629 625
630 i2c = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 626 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
631 if (i2c == NULL) { 627 if (i2c == NULL) {
632 kfree(codec); 628 kfree(codec);
633 return -ENOMEM; 629 return -ENOMEM;
634 } 630 }
635 memcpy(i2c, &client_template, sizeof(struct i2c_client));
636 i2c_set_clientdata(i2c, codec); 631 i2c_set_clientdata(i2c, codec);
637 codec->control_data = i2c; 632 codec->control_data = i2c;
638 633
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index c1ffb61ef7f7..7073e8e294fc 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -807,15 +807,10 @@ static int wm8750_init(struct snd_soc_device *socdev)
807 codec->dapm_event = wm8750_dapm_event; 807 codec->dapm_event = wm8750_dapm_event;
808 codec->dai = &wm8750_dai; 808 codec->dai = &wm8750_dai;
809 codec->num_dai = 1; 809 codec->num_dai = 1;
810 codec->reg_cache_size = ARRAY_SIZE(wm8750_reg); 810 codec->reg_cache_size = sizeof(wm8750_reg);
811 811 codec->reg_cache = kmemdup(wm8750_reg, sizeof(wm8750_reg), GFP_KRENEL);
812 codec->reg_cache =
813 kzalloc(sizeof(u16) * ARRAY_SIZE(wm8750_reg), GFP_KERNEL);
814 if (codec->reg_cache == NULL) 812 if (codec->reg_cache == NULL)
815 return -ENOMEM; 813 return -ENOMEM;
816 memcpy(codec->reg_cache, wm8750_reg,
817 sizeof(u16) * ARRAY_SIZE(wm8750_reg));
818 codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm8750_reg);
819 814
820 wm8750_reset(codec); 815 wm8750_reset(codec);
821 816
@@ -900,12 +895,11 @@ static int wm8750_codec_probe(struct i2c_adapter *adap, int addr, int kind)
900 client_template.adapter = adap; 895 client_template.adapter = adap;
901 client_template.addr = addr; 896 client_template.addr = addr;
902 897
903 i2c = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 898 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
904 if (i2c == NULL) { 899 if (i2c == NULL) {
905 kfree(codec); 900 kfree(codec);
906 return -ENOMEM; 901 return -ENOMEM;
907 } 902 }
908 memcpy(i2c, &client_template, sizeof(struct i2c_client));
909 i2c_set_clientdata(i2c, codec); 903 i2c_set_clientdata(i2c, codec);
910 codec->control_data = i2c; 904 codec->control_data = i2c;
911 905