commit | 0fdec0ce783eb188e10d83177de532019a6bcd8b | [log] [tgz] |
---|---|---|
author | qctecmdr <qctecmdr@localhost> | Wed Sep 18 03:55:29 2019 -0700 |
committer | Gerrit - the friendly Code Review server <code-review@localhost> | Wed Sep 18 03:55:29 2019 -0700 |
tree | c766f0980b841561ee18b68f38ff7ec27bc058db | |
parent | 640a31f8814c9f2b91f03bee871ef170b535b10b [diff] | |
parent | 5c51bff55e85bccc8826f1ad79eb2ffecc744906 [diff] |
Merge "hal: fix integer overflow error in usb"
diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c index c1ee008..a2d559d 100644 --- a/hal/audio_extn/usb.c +++ b/hal/audio_extn/usb.c
@@ -1138,10 +1138,11 @@ uint32_t tries = _MIN(sample_rate_size, (uint32_t)__builtin_popcount(bm)); int i = 0; - while (tries--) { + while (tries) { int idx = __builtin_ffs(bm) - 1; sample_rates[i++] = supported_sample_rates[idx]; bm &= ~(1<<idx); + tries--; } return i;