Merge pull request #2366 from angmolin/bugfix/gcc+12-strict-overflow-warning

Fix strict-overflow warning when compiling with gcc >= 12
This commit is contained in:
HiFiPhile 2023-12-10 17:22:43 +01:00 committed by GitHub
commit 71f1400aea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1565,7 +1565,8 @@ uint16_t audiod_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
{
uint8_t const *p_desc = _audiod_fct[i].p_desc;
uint8_t const *p_desc_end = p_desc + _audiod_fct[i].desc_length - TUD_AUDIO_DESC_IAD_LEN;
while (p_desc < p_desc_end)
// Condition modified from p_desc < p_desc_end to prevent gcc>=12 strict-overflow warning
while (p_desc_end - p_desc > 0)
{
if (tu_desc_type(p_desc) == TUSB_DESC_ENDPOINT)
{