Skip to content

Commit

Permalink
ALSA: pcm: snd_interval_step: drop the min parameter
Browse files Browse the repository at this point in the history
The min parameter was not used by any caller.  And if it were used,
underflows in the calculations could lead to incorrect results.

Signed-off-by: Clemens Ladisch <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
cladisch authored and tiwai committed Sep 8, 2014
1 parent d89c6c0 commit 0f519b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,16 +1113,16 @@ int snd_interval_list(struct snd_interval *i, unsigned int count,

EXPORT_SYMBOL(snd_interval_list);

static int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int step)
static int snd_interval_step(struct snd_interval *i, unsigned int step)
{
unsigned int n;
int changed = 0;
n = (i->min - min) % step;
n = i->min % step;
if (n != 0 || i->openmin) {
i->min += step - n;
changed = 1;
}
n = (i->max - min) % step;
n = i->max % step;
if (n != 0 || i->openmax) {
i->max -= n;
changed = 1;
Expand Down Expand Up @@ -1427,7 +1427,7 @@ static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{
unsigned long step = (unsigned long) rule->private;
return snd_interval_step(hw_param_interval(params, rule->var), 0, step);
return snd_interval_step(hw_param_interval(params, rule->var), step);
}

/**
Expand Down

0 comments on commit 0f519b6

Please sign in to comment.