Skip to content

Commit

Permalink
USB: prevent compiler warning (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradCvjetkovic authored May 28, 2024
1 parent a3b101d commit 46dcb3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Components/USB/Source/usbd_lib_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "usbd_lib_core.h"

#include <stddef.h>
#include <string.h>

#include "usb_lib_debug.h"
Expand Down Expand Up @@ -416,7 +417,7 @@ usbStatus USBD_SetSerialNumber (uint8_t device, const char *string) {
str_len = ptr_dev_cfg->ser_num_str_len;
}

ptr_str_desc_str = ((uint8_t *)(&((USB_STRING_DESCRIPTOR *)ptr_str_desc)->bString));
ptr_str_desc_str = (uint8_t *)ptr_str_desc + offsetof(USB_STRING_DESCRIPTOR, bString);

ptr_str_desc->bLength = (uint8_t)((str_len * 2U) + 2U);
ptr_str_desc->bDescriptorType = USB_STRING_DESCRIPTOR_TYPE;
Expand Down

0 comments on commit 46dcb3e

Please sign in to comment.