Skip to content

Commit

Permalink
ALSA: pcm: Fix interval evaluation with openmin/max
Browse files Browse the repository at this point in the history
As addressed in alsa-lib (commit b420056604f0), we need to fix the
case where the evaluation of PCM interval "(x x+1]" leading to
-EINVAL.  After applying rules, such an interval may be translated as
"(x x+1)".

Fixes: ff2d6ac ("ALSA: pcm: Fix snd_interval_refine first/last with open min/max")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Nov 29, 2018
1 parent 3deef52 commit 5363857
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/sound/pcm_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,13 @@ static inline int snd_interval_empty(const struct snd_interval *i)
static inline int snd_interval_single(const struct snd_interval *i)
{
return (i->min == i->max ||
(i->min + 1 == i->max && i->openmax));
(i->min + 1 == i->max && (i->openmin || i->openmax)));
}

static inline int snd_interval_value(const struct snd_interval *i)
{
if (i->openmin && !i->openmax)
return i->max;
return i->min;
}

Expand Down

0 comments on commit 5363857

Please sign in to comment.