diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-03-13 13:31:25 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-03-13 17:37:58 +0300 |
commit | 09b9ddfaa18317f463085d602cf5f60a5fa88665 (patch) | |
tree | 0a3d697519ee40efce1ba0e46f591bbdc2c03377 /sound/core | |
parent | 5730f9f744cfe20b771adc33f3b476b95d3eebba (diff) | |
download | linux-09b9ddfaa18317f463085d602cf5f60a5fa88665.tar.xz |
ALSA: pcm: Use krealloc() for resizing the rules array
Just a minor simplification. Change from kcalloc() shouldn't matter
as each array element is fully initialized.
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a83152e7d387..f4a19509cccf 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1129,16 +1129,12 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, if (constrs->rules_num >= constrs->rules_all) { struct snd_pcm_hw_rule *new; unsigned int new_rules = constrs->rules_all + 16; - new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); + new = krealloc(constrs->rules, new_rules * sizeof(*c), + GFP_KERNEL); if (!new) { va_end(args); return -ENOMEM; } - if (constrs->rules) { - memcpy(new, constrs->rules, - constrs->rules_num * sizeof(*c)); - kfree(constrs->rules); - } constrs->rules = new; constrs->rules_all = new_rules; } |