summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-02-05 14:56:20 +0100
committerJaroslav Kysela <perex@suse.cz>2007-02-09 09:03:56 +0100
commit88cb42901f1572c95f5933f363cfebd5044c716a (patch)
tree8eed3d46c81996e780375ff91ae1955f3265629d /sound/soc/codecs
parent1ab774e049085da6facfaf3b24d54158c3f0f5b3 (diff)
[ALSA] soc - Clean up with kmemdup()
Clean up by replacing with kmemdup(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
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 e6b990507df..7ca0b526828 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)
codec->dapm_event = wm8731_dapm_event;
codec->dai = &wm8731_dai;
codec->num_dai = 1;
- codec->reg_cache_size = ARRAY_SIZE(wm8731_reg);
- codec->reg_cache =
- kzalloc(sizeof(u16) * ARRAY_SIZE(wm8731_reg), GFP_KERNEL);
+ codec->reg_cache_size = sizeof(wm8731_reg);
+ codec->reg_cache = kmemdup(wm8731_reg, sizeof(wm8731_reg), GFP_KERNEL);
if (codec->reg_cache == NULL)
return -ENOMEM;
- memcpy(codec->reg_cache,
- wm8731_reg, sizeof(u16) * ARRAY_SIZE(wm8731_reg));
- codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm8731_reg);
wm8731_reset(codec);
@@ -627,12 +623,11 @@ static int wm8731_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap;
client_template.addr = addr;
- i2c = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
return -ENOMEM;
}
- memcpy(i2c, &client_template, sizeof(struct i2c_client));
i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index c1ffb61ef7f..7073e8e294f 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)
codec->dapm_event = wm8750_dapm_event;
codec->dai = &wm8750_dai;
codec->num_dai = 1;
- codec->reg_cache_size = ARRAY_SIZE(wm8750_reg);
-
- codec->reg_cache =
- kzalloc(sizeof(u16) * ARRAY_SIZE(wm8750_reg), GFP_KERNEL);
+ codec->reg_cache_size = sizeof(wm8750_reg);
+ codec->reg_cache = kmemdup(wm8750_reg, sizeof(wm8750_reg), GFP_KRENEL);
if (codec->reg_cache == NULL)
return -ENOMEM;
- memcpy(codec->reg_cache, wm8750_reg,
- sizeof(u16) * ARRAY_SIZE(wm8750_reg));
- codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm8750_reg);
wm8750_reset(codec);
@@ -900,12 +895,11 @@ static int wm8750_codec_probe(struct i2c_adapter *adap, int addr, int kind)
client_template.adapter = adap;
client_template.addr = addr;
- i2c = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
+ i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
if (i2c == NULL) {
kfree(codec);
return -ENOMEM;
}
- memcpy(i2c, &client_template, sizeof(struct i2c_client));
i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;