ALSA: control: fix numid conflict check for new controls
authorClemens Ladisch <clemens@ladisch.de>
Mon, 7 Mar 2011 12:22:50 +0000 (13:22 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 8 Mar 2011 11:59:48 +0000 (12:59 +0100)
commit7c7335877105364f7f5181e80ff34206b54be81f
tree59d80caf4d634ff51765aa53dea8c4da4903e156
parentbdd3255d3adcb9f4fd70c09ec71eb1c5b36d833e
ALSA: control: fix numid conflict check for new controls

The purpose of the snd_ctl_hole_check() function is to find conflicts
between the numerical IDs of the new control and those of any existing
controls.  However, it would fail to detect an existing control whose
count is smaller than the new control's count and whose interval of IDs
is entirely contained in the interval of the new control's IDs.

To fix this, use the correct formula to detect overlapping intervals,
which happens to simplify the condition.

This problem was not encountered so far because ALSA does not yet allow
drivers to allocate specific control IDs.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/control.c