[alsa-devel] [alsa-lib][PATCH] ctl: fix returning zero for dimension level 4

Takashi Sakamoto o-takashi at sakamocchi.jp
Mon Jun 27 15:02:57 CEST 2016


In ALSA kernel/userspace interfaces, 'struct snd_ctl_elem_info' has a
'dimension' parameter. This parameter consists of an array with four
elements. Each element represents the number of members in corresponding
dimension level to construct matrix.

In current implementation, a get function, 'snd_ctl_elem_info_get_dimension()'
is hardcoded to return zero to level 4, against actual value. This commit fixes
the bug.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 src/control/control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/control/control.c b/src/control/control.c
index d515cff..0cb0105 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -2483,7 +2483,7 @@ int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int
 #endif
 {
 	assert(obj);
-	if (idx >= 3)
+	if (idx > 3)
 		return 0;
 	return obj->dimen.d[idx];
 }
-- 
2.7.4



More information about the Alsa-devel mailing list