From: Lukasz Majewski Date: Thu, 21 Nov 2019 23:39:20 +0100 Subject: [U-Boot] [PATCH v2 2/2] usb: dwc2: fix possible alignment issues In-Reply-To: <20191121211523.7219-2-simon.k.r.goldschmidt@gmail.com> References: <20191121211523.7219-1-simon.k.r.goldschmidt@gmail.com> <20191121211523.7219-2-simon.k.r.goldschmidt@gmail.com> Message-ID: <20191121233920.79281566@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On Thu, 21 Nov 2019 22:15:23 +0100 Simon Goldschmidt wrote: > 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 > --- > > Changes in v2: None > > drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c > b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c index > 7eb632d3b1..dba221dad0 100644 --- > a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +++ > b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c @@ -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)); > @@ -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" Acked-by: Lukasz Majewski Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: