Since upgrading to gcc9, warnings are issued:
"taking address of packed member of ‘...’ may result in an unaligned
pointer value"
This patch is refered to below commit
- commit
616ebd8b9cb "usb: composite: fix possible alignment issues"
Change-Id: Idceb5b56f7daf1481de528f95a1a2f1f9b57c0dd
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
/* big enough to hold our biggest descriptor */
#define USB_BUFSIZ 512
/* big enough to hold our biggest descriptor */
#define USB_BUFSIZ 512
+typedef struct { __le16 val;} __attribute__((aligned(16))) __le16_packed;
+
static struct usb_composite_driver *composite;
/* Some systems will need runtime overrides for the product identifers
static struct usb_composite_driver *composite;
/* Some systems will need runtime overrides for the product identifers
-static void collect_langs(struct usb_gadget_strings **sp, __le16 *buf)
+static void collect_langs(struct usb_gadget_strings **sp, void *buf)
{
const struct usb_gadget_strings *s;
u16 language;
{
const struct usb_gadget_strings *s;
u16 language;
+ __le16_packed *tmp;
+ __le16_packed *end = (buf + 252);
while (*sp) {
s = *sp;
language = cpu_to_le16(s->language);
while (*sp) {
s = *sp;
language = cpu_to_le16(s->language);
- for (tmp = buf; *tmp && tmp < &buf[126]; tmp++) {
- if (*tmp == language)
+ for (tmp = buf; tmp->val && tmp < end; tmp++) {
+ if (tmp->val == language)