summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-11-29 12:05:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-13 09:22:31 +0100
commitbceb7beeed4aed277b2ec8e0e86b5520a8626ea1 (patch)
treec9c28c61f9714a46cb950f4eb3f821e48a97baa8 /include
parentd26525be5f2aa25e596fb293b7d2027835ebf214 (diff)
downloadlinux-stable-bceb7beeed4aed277b2ec8e0e86b5520a8626ea1.tar.gz
linux-stable-bceb7beeed4aed277b2ec8e0e86b5520a8626ea1.tar.bz2
linux-stable-bceb7beeed4aed277b2ec8e0e86b5520a8626ea1.zip
ALSA: pcm: Fix interval evaluation with openmin/max
commit 5363857b916c1f48027e9b96ee8be8376bf20811 upstream. 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: ff2d6acdf6f1 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/pcm_params.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 6b1c78f05fab..54c4d4ef0cb4 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -272,11 +272,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;
}