From: Krzysztof Helt Date: Sat, 19 Dec 2009 17:31:04 +0000 (+0100) Subject: ALSA: fix incorrect rounding direction in snd_interval_ratnum() X-Git-Tag: v2.6.33-rc2~42^2^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40962d7c741de1c21b6ce8516c1d9f8836fb383e;p=pandora-kernel.git ALSA: fix incorrect rounding direction in snd_interval_ratnum() The direction of rounding is incorrect in the snd_interval_ratnum() It was detected with following parameters (sb8 driver playing 8kHz stereo file): - num is always 1000000 - requested frequency rate is from 7999 to 7999 (single frequency) The first loop calculates div_down(num, freq->min) which is 125. Thus, a frequency range's minimum value is 1000000 / 125 = 8000 Hz. The second loop calculates div_up(num, freq->max) which is 126 The frequency range's maximum value is 1000000 / 126 = 7936 Hz. The range maximum is lower than the range minimum so the function fails due to empty result range. Signed-off-by: Krzysztof Helt Signed-off-by: Takashi Iwai --- Reading git-diff-tree failed