Skip to content

Commit 785e365

Browse files
thugheskartben
authored andcommitted
tests: subsys: usb: bos: Remove dummy_descriptor struct
When building with clang, it warns: tests/subsys/usb/bos/src/test_bos.c:24:22: error: variable 'dummy_descriptor' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] static const uint8_t dummy_descriptor[] = { ^ Only the size of dummy_descriptor is used, not the contents. Replace the struct with a constant for the size. Signed-off-by: Tom Hughes <tomhughes@chromium.org>
1 parent dd6adc7 commit 785e365

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tests/subsys/usb/bos/src/test_bos.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ LOG_MODULE_REGISTER(test_main, LOG_LEVEL_DBG);
2121
* Compare old style USB BOS definition with section aligned
2222
*/
2323

24-
static const uint8_t dummy_descriptor[] = {
25-
0x00, 0x01, 0x02
26-
};
27-
2824
static struct webusb_bos_desc {
2925
struct usb_bos_descriptor bos;
3026
struct usb_bos_platform_descriptor platform_webusb;
@@ -91,8 +87,8 @@ static struct webusb_bos_desc {
9187
.capability_data_msos = {
9288
/* Windows version (8.1) (0x06030000) */
9389
.dwWindowsVersion = sys_cpu_to_le32(0x06030000),
94-
.wMSOSDescriptorSetTotalLength =
95-
sys_cpu_to_le16(sizeof(dummy_descriptor)),
90+
/* The MSOS2.0 descriptor is not relevant here. */
91+
.wMSOSDescriptorSetTotalLength = 0,
9692
.bMS_VendorCode = 0x02,
9793
.bAltEnumCode = 0x00
9894
}
@@ -160,8 +156,8 @@ USB_DEVICE_BOS_DESC_DEFINE_CAP struct usb_bos_msosv2 {
160156
.cap = {
161157
/* Windows version (8.1) (0x06030000) */
162158
.dwWindowsVersion = sys_cpu_to_le32(0x06030000),
163-
.wMSOSDescriptorSetTotalLength =
164-
sys_cpu_to_le16(sizeof(dummy_descriptor)),
159+
/* The MSOS2.0 descriptor is not relevant here. */
160+
.wMSOSDescriptorSetTotalLength = 0,
165161
.bMS_VendorCode = 0x02,
166162
.bAltEnumCode = 0x00,
167163
},

0 commit comments

Comments
 (0)