forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
5730f9f744
commit
09b9ddfaa1
|
@ -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) {
|
if (constrs->rules_num >= constrs->rules_all) {
|
||||||
struct snd_pcm_hw_rule *new;
|
struct snd_pcm_hw_rule *new;
|
||||||
unsigned int new_rules = constrs->rules_all + 16;
|
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) {
|
if (!new) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
if (constrs->rules) {
|
|
||||||
memcpy(new, constrs->rules,
|
|
||||||
constrs->rules_num * sizeof(*c));
|
|
||||||
kfree(constrs->rules);
|
|
||||||
}
|
|
||||||
constrs->rules = new;
|
constrs->rules = new;
|
||||||
constrs->rules_all = new_rules;
|
constrs->rules_all = new_rules;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user