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 <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-09-01 10:58:57 -05:00 committed by Kumar Gala
parent 91f172e4ad
commit a3480cf87c

View file

@ -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;