Skip to contentSkip to conversation

ALSA: pcm: Fix interval evaluation with openmin/max

PATCH New Takashi Iwai 1 participant 1 message Nov 29, 2018 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: Fix interval evaluation with openmin/max

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")
---
 include/sound/pcm_params.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/sound/pcm_params.h +3 -1
index 2dd37cada7c0..888a833d3b00 100644
@@ -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;
 }
 
Signature · 1 line
2.19.1