Skip to content

Commit a3480cf

Browse files
committed
usb: Fix building error in usb_descriptor with misra test
When we build tests/kernel/common/kernel.common.misra on bl654_usb we get the following error: subsys/usb/usb_descriptor.c:313:2: error: ISO C90 forbids array 'hwid' whose size cannot be evaluated [-Werror=vla] Fix by removing use of usblen variable in array. Signed-off-by: Kumar Gala <[email protected]>
1 parent 91f172e commit a3480cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/usb/usb_descriptor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ __weak uint8_t *usb_update_sn_string_descriptor(void)
310310
* unless the user requested a longer serial number.
311311
*/
312312
const int usblen = sizeof(CONFIG_USB_DEVICE_SN) / 2;
313-
uint8_t hwid[MAX(16, usblen)];
313+
uint8_t hwid[MAX(16, sizeof(CONFIG_USB_DEVICE_SN) / 2)];
314314
static uint8_t sn[sizeof(CONFIG_USB_DEVICE_SN) + 1];
315315
const char hex[] = "0123456789ABCDEF";
316316
int hwlen, skip;

0 commit comments

Comments
 (0)