John Keeping f2f69bf65d usb: gadget: u_audio: fix calculations for small bInterval
If bInterval is 1, then p_interval is 8000 and p_interval_mil is 8E9,
which is too big for a 32-bit value.  While the storage is indeed
64-bit, this value is used as the divisor in do_div() which will
truncate it into a uint32_t leading to incorrect calculated values.

Switch back to keeping the base value in struct snd_uac_chip which fits
easily into an int, meaning that the division can be done in two steps
with the divisor fitting safely into a uint32_t on both steps.

Fixes: 6fec018a7e70 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback")
Tested-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20220104183243.718258-1-john@metanate.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-06 15:28:45 +01:00
..
2021-11-06 14:36:12 -07:00
2021-11-01 10:09:14 -07:00
2021-12-22 10:11:17 -08:00
2021-11-03 17:00:52 -07:00
2021-11-08 11:49:48 -08:00
2021-12-13 13:18:48 +05:30
2021-11-05 08:42:02 -07:00
2021-12-21 16:22:58 +01:00
2021-11-04 13:56:55 -07:00
2021-11-26 22:54:47 +01:00
2021-12-17 11:46:07 -08:00
2021-11-22 14:58:57 -08:00
2021-11-06 14:36:12 -07:00
2021-11-10 11:36:43 -08:00
2021-10-26 19:12:01 +02:00
2021-11-10 10:56:02 -08:00
2021-10-18 09:29:27 +02:00
2021-11-02 06:20:58 -07:00
2021-11-02 15:58:39 -07:00
2021-12-24 08:58:23 -08:00
2021-11-08 12:07:52 -08:00
2021-11-10 09:07:26 -08:00
2021-11-12 11:44:31 -08:00
2021-12-31 09:22:25 -08:00
2021-12-16 15:02:26 +01:00
2021-12-20 10:23:19 -08:00
2021-12-23 09:22:34 -08:00
2021-11-30 11:41:49 -07:00
2021-12-05 09:13:20 -08:00
2021-11-10 09:41:22 -08:00
2021-12-08 14:53:15 -05:00