[PATCH 4/4] USB: gadget: Compile composite.c with -Wno-address-of-packed-member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GCC9 for ARM produces the following warnings:

drivers/usb/gadget/composite.c: In function 'bos_desc':
drivers/usb/gadget/composite.c:522:15: warning: taking address of packed member of 'struct usb_bos_descriptor' may result in an unaligned pointer value [-Waddress-of-packed-member]
  522 |  le16_add_cpu(&bos->wTotalLength, USB_DT_USB_EXT_CAP_SIZE);
      |               ^~~~~~~~~~~~~~~~~~
drivers/usb/gadget/composite.c:534:15: warning: taking address of packed member of 'struct usb_bos_descriptor' may result in an unaligned pointer value [-Waddress-of-packed-member]
  534 |  le16_add_cpu(&bos->wTotalLength, USB_DT_USB_SS_CAP_SIZE);
      |               ^~~~~~~~~~~~~~~~~~
drivers/usb/gadget/composite.c: In function 'get_string':
drivers/usb/gadget/composite.c:928:23: warning: taking address of packed member of 'struct usb_string_descriptor' may result in an unaligned pointer value [-Waddress-of-packed-member]
  928 |    collect_langs(sp, s->wData);
      |                      ~^~~~~~~
drivers/usb/gadget/composite.c:933:24: warning: taking address of packed member of 'struct usb_string_descriptor' may result in an unaligned pointer value [-Waddress-of-packed-member]
  933 |     collect_langs(sp, s->wData);
      |                       ~^~~~~~~
drivers/usb/gadget/composite.c:938:25: warning: taking address of packed member of 'struct usb_string_descriptor' may result in an unaligned pointer value [-Waddress-of-packed-member]
  938 |      collect_langs(sp, s->wData);
      |                        ~^~~~~~~
drivers/usb/gadget/composite.c:945:23: warning: taking address of packed member of 'struct usb_string_descriptor' may result in an unaligned pointer value [-Waddress-of-packed-member]
  945 |    collect_langs(sp, s->wData);
      |                      ~^~~~~~~

the offending code seems OK and there doesn't seem to be a way to fix
this in code, so disable the warning for that file.

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 drivers/usb/gadget/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 9ef594575b..8d399e568f 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -1,4 +1,6 @@
 
+CFLAGS_composite.o := -Wno-address-of-packed-member
+
 obj-$(CONFIG_USB_GADGET) += composite.o config.o usbstring.o epautoconf.o udc-core.o functions.o config.o multi.o
 obj-$(CONFIG_USB_GADGET_SERIAL) += u_serial.o serial.o f_serial.o f_acm.o
 obj-$(CONFIG_USB_GADGET_DFU) += dfu.o
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux