Fix IAR warnings.

Pa039 : use of address of unaligned structure member.
Pe188: enumerated type mixed with another type.
This commit is contained in:
Mengsk
2020-06-16 14:13:30 +02:00
parent 8a67f81397
commit 57b553e023
4 changed files with 14 additions and 10 deletions

View File

@@ -194,7 +194,9 @@ uint16_t hidd_open(uint8_t rhport, tusb_desc_interface_t const * desc_itf, uint1
p_hid->boot_mode = false; // default mode is REPORT
p_hid->itf_num = desc_itf->bInterfaceNumber;
memcpy(&p_hid->report_desc_len, &(p_hid->hid_descriptor->wReportLength), 2);
// Use offsetof to avoid pointer to the odd/misaligned address
memcpy(&p_hid->report_desc_len, (uint8_t*) p_hid->hid_descriptor + offsetof(tusb_hid_descriptor_hid_t, wReportLength), 2);
// Prepare for output endpoint
if (p_hid->ep_out)