Skip to content

Commit 71f1400

Browse files
authored
Merge pull request #2366 from angmolin/bugfix/gcc+12-strict-overflow-warning
Fix strict-overflow warning when compiling with gcc >= 12
2 parents 338ff2d + 506617d commit 71f1400

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/class/audio/audio_device.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,8 @@ uint16_t audiod_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
15651565
{
15661566
uint8_t const *p_desc = _audiod_fct[i].p_desc;
15671567
uint8_t const *p_desc_end = p_desc + _audiod_fct[i].desc_length - TUD_AUDIO_DESC_IAD_LEN;
1568-
while (p_desc < p_desc_end)
1568+
// Condition modified from p_desc < p_desc_end to prevent gcc>=12 strict-overflow warning
1569+
while (p_desc_end - p_desc > 0)
15691570
{
15701571
if (tu_desc_type(p_desc) == TUSB_DESC_ENDPOINT)
15711572
{

0 commit comments

Comments
 (0)