[ALSA] ASoC WM9712 kmemdup
This patch creates the WM9712 codec register cache using kmemdup instead of doing a kzalloc followed by a memcpy. Signed-off-by: Graeme Gregory <gg@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
committed by
Jaroslav Kysela
parent
826220463f
commit
30652c4506
@@ -676,14 +676,13 @@ static int wm9712_soc_probe(struct platform_device *pdev)
|
|||||||
codec = socdev->codec;
|
codec = socdev->codec;
|
||||||
mutex_init(&codec->mutex);
|
mutex_init(&codec->mutex);
|
||||||
|
|
||||||
codec->reg_cache =
|
codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL);
|
||||||
kzalloc(sizeof(u16) * ARRAY_SIZE(wm9712_reg), GFP_KERNEL);
|
|
||||||
if (codec->reg_cache == NULL) {
|
if (codec->reg_cache == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto cache_err;
|
goto cache_err;
|
||||||
}
|
}
|
||||||
memcpy(codec->reg_cache, wm9712_reg, sizeof(u16) * ARRAY_SIZE(wm9712_reg));
|
codec->reg_cache_size = sizeof(wm9712_reg);
|
||||||
codec->reg_cache_size = sizeof(u16) * ARRAY_SIZE(wm9712_reg);
|
|
||||||
codec->reg_cache_step = 2;
|
codec->reg_cache_step = 2;
|
||||||
|
|
||||||
codec->name = "WM9712";
|
codec->name = "WM9712";
|
||||||
|
Reference in New Issue
Block a user