Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fdec0ce authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: fix integer overflow error in usb"

parents 640a31f8 5c51bff5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1138,10 +1138,11 @@ int usb_get_sup_sample_rates(bool is_playback,
    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;