summaryrefslogtreecommitdiff
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-04-02 20:50:41 +0300
committerTakashi Iwai <tiwai@suse.de>2018-04-02 20:50:59 +0300
commitbc334cb61b9ee6e85b9bb01519989a3ae8fe03f6 (patch)
tree34424a812537fe11beeee727b30b19c67193fe36 /sound/core/pcm_native.c
parent5607dddbfca774fb38bffadcb077fe03aa4ac5c6 (diff)
parentb44d419b98fae759b4f746186b1d1c8d01d962f2 (diff)
downloadlinux-bc334cb61b9ee6e85b9bb01519989a3ae8fe03f6.tar.xz
Merge branch 'for-next' into for-linus
Preparation for 4.17 merge. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index d18b3982548b..b84554893fab 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -323,7 +323,7 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
struct snd_pcm_hw_constraints *constrs =
&substream->runtime->hw_constraints;
unsigned int k;
- unsigned int rstamps[constrs->rules_num];
+ unsigned int *rstamps;
unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1];
unsigned int stamp;
struct snd_pcm_hw_rule *r;
@@ -331,7 +331,7 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
struct snd_mask old_mask;
struct snd_interval old_interval;
bool again;
- int changed;
+ int changed, err = 0;
/*
* Each application of rule has own sequence number.
@@ -339,8 +339,9 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
* Each member of 'rstamps' array represents the sequence number of
* recent application of corresponding rule.
*/
- for (k = 0; k < constrs->rules_num; k++)
- rstamps[k] = 0;
+ rstamps = kcalloc(constrs->rules_num, sizeof(unsigned int), GFP_KERNEL);
+ if (!rstamps)
+ return -ENOMEM;
/*
* Each member of 'vstamps' array represents the sequence number of
@@ -398,8 +399,10 @@ retry:
}
changed = r->func(params, r);
- if (changed < 0)
- return changed;
+ if (changed < 0) {
+ err = changed;
+ goto out;
+ }
/*
* When the parameter is changed, notify it to the caller
@@ -430,7 +433,9 @@ retry:
if (again)
goto retry;
- return 0;
+ out:
+ kfree(rstamps);
+ return err;
}
static int fixup_unreferenced_params(struct snd_pcm_substream *substream,