Skip to content

Commit

Permalink
usb: dwc2: fix possible alignment issues
Browse files Browse the repository at this point in the history
Since upgrading to gcc9, warnings are issued:
"taking address of packed member of ‘...’ may result in an unaligned
pointer value"

Fix this by converting dwc2_fifo_read to use unaligned access since packed
structures may be on an unaligned address, depending on USB hardware.

Signed-off-by: Simon Goldschmidt <[email protected]>
  • Loading branch information
goldsimon authored and Marek Vasut committed Nov 22, 2019
1 parent 616ebd8 commit 7dc0ac6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ static int write_fifo_ep0(struct dwc2_ep *ep, struct dwc2_request *req)
return 0;
}

static int dwc2_fifo_read(struct dwc2_ep *ep, u32 *cp, int max)
static int dwc2_fifo_read(struct dwc2_ep *ep, void *cp, int max)
{
invalidate_dcache_range((unsigned long)cp, (unsigned long)cp +
ROUND(max, CONFIG_SYS_CACHELINE_SIZE));
Expand Down Expand Up @@ -1285,7 +1285,7 @@ static void dwc2_ep0_setup(struct dwc2_udc *dev)
nuke(ep, -EPROTO);

/* read control req from fifo (8 bytes) */
dwc2_fifo_read(ep, (u32 *)usb_ctrl, 8);
dwc2_fifo_read(ep, usb_ctrl, 8);

debug_cond(DEBUG_SETUP != 0,
"%s: bRequestType = 0x%x(%s), bRequest = 0x%x"
Expand Down

0 comments on commit 7dc0ac6

Please sign in to comment.