openinput: return early instead of making an error-prone zero-sized VLA

Fixes a clang-analyze warning.
This commit is contained in:
Yaroslav Chvanov
2023-05-20 10:57:00 +03:00
parent cf202eeeca
commit 4240e067a9

View File

@@ -386,6 +386,11 @@ openinput_read_supported_function_pages(struct ratbag_device *device)
return ret;
total = count + left;
if (total == 0) {
log_debug(ratbag,
"openinput: not proceeding to read device functions as there are 0 pages\n");
return 0;
}
uint8_t pages[total];
memcpy(pages, buffer, count);