diff options
Diffstat (limited to 'sound/core/pcm_lib.c')
-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, | |||
1129 | if (constrs->rules_num >= constrs->rules_all) { | 1129 | if (constrs->rules_num >= constrs->rules_all) { |
1130 | struct snd_pcm_hw_rule *new; | 1130 | struct snd_pcm_hw_rule *new; |
1131 | unsigned int new_rules = constrs->rules_all + 16; | 1131 | unsigned int new_rules = constrs->rules_all + 16; |
1132 | new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); | 1132 | new = krealloc(constrs->rules, new_rules * sizeof(*c), |
1133 | GFP_KERNEL); | ||
1133 | if (!new) { | 1134 | if (!new) { |
1134 | va_end(args); | 1135 | va_end(args); |
1135 | return -ENOMEM; | 1136 | return -ENOMEM; |
1136 | } | 1137 | } |
1137 | if (constrs->rules) { | ||
1138 | memcpy(new, constrs->rules, | ||
1139 | constrs->rules_num * sizeof(*c)); | ||
1140 | kfree(constrs->rules); | ||
1141 | } | ||
1142 | constrs->rules = new; | 1138 | constrs->rules = new; |
1143 | constrs->rules_all = new_rules; | 1139 | constrs->rules_all = new_rules; |
1144 | } | 1140 | } |