Skip to content

Commit

Permalink
usb: Fix building error in usb_descriptor with misra test
Browse files Browse the repository at this point in the history
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 <kumar.gala@linaro.org>
  • Loading branch information
galak committed Sep 1, 2021
1 parent 91f172e commit a3480cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/usb/usb_descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ __weak uint8_t *usb_update_sn_string_descriptor(void)
* unless the user requested a longer serial number.
*/
const int usblen = sizeof(CONFIG_USB_DEVICE_SN) / 2;
uint8_t hwid[MAX(16, usblen)];
uint8_t hwid[MAX(16, sizeof(CONFIG_USB_DEVICE_SN) / 2)];
static uint8_t sn[sizeof(CONFIG_USB_DEVICE_SN) + 1];
const char hex[] = "0123456789ABCDEF";
int hwlen, skip;
Expand Down

0 comments on commit a3480cf

Please sign in to comment.