From patchwork Thu Nov 21 21:15:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1199139 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DLRUnWAi"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47Jsmt0DYrz9sPJ for ; Fri, 22 Nov 2019 08:16:14 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C205FC21FBB; Thu, 21 Nov 2019 21:15:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C45D9C21FBF; Thu, 21 Nov 2019 21:15:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8CD7CC21FE4; Thu, 21 Nov 2019 21:15:38 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 05B60C21F8C for ; Thu, 21 Nov 2019 21:15:36 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id z19so5353323wmk.3 for ; Thu, 21 Nov 2019 13:15:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JW24aMFtghBBjneiUMffIWmafGq7YNPLxOlyodKDSNo=; b=DLRUnWAir7UYEFk6wwoZBWDBMGkF/kS+iAGZMv6tLQGqcdKf1Hy0Ch7yRsixmJNyBS SKJI6MmVu6lJg09kn7a3PJPP8PZFTONnvsCx28GVE5TiCAEGUT9Gx7VUqCAVskia19fb BqhFIONFkpsR7UTLYPD84O8mgIdDgI+p7wmk6+EFxQak8PZrdgR+YSEkT2o6AeSdEPQX N2uj+66UyV0kV2U52+UGjg4+CuUl12FL833iuhnDAfRmzC678JcGSlZpXCs0O0uUvP/n w3rKMWYFQVSvVqQQKK26dl3yOurhJ1uwf/bhQyrH6g7PcbBOrllELjYIA6fSwEWvO8fD A1og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JW24aMFtghBBjneiUMffIWmafGq7YNPLxOlyodKDSNo=; b=YVh7zLw99I8w+XquiUraPlDy0HBtsaw5uzEZYAaJDQStlXTk+0+vPfTvJO1OrN9Rvx c4RLUQsQVQfDxRR731MVZu5eNSY/RwVp73uyzUenv2CGTGtWPSy7rzkpg/uZurNSrrgy f2k0YDve/IAayJjci7IoxvClaRZDok9ZSwsdJzukrp3RptlLOe320hh/9iG2JfsdUiYb yFjSa7YUUFh0yIvKfFBnmn+02k8WUBpBbZGOAJn4uWpAvy1OYLz531YYpKhTXcUGC9X4 GvF+OeVIxcKpWvcxgpAbJexRLpmKvj57puHGDLWBbWTheFz9dJPQoHPHTomiQDj7hntI ZIww== X-Gm-Message-State: APjAAAUqsJJTOuOnMPtaIhsXiR0kIq9mtOcrQzYpwcZCT5Pfg93OUx5e IaqI+EihMpWFKGCkwyJn1es= X-Google-Smtp-Source: APXvYqyH3HZyL5brGYey7HK+W5PCRFbMOLhSathUZrM/5cSoNmN+tqkXV7uHeqhhszp2ZR2+3nUW3g== X-Received: by 2002:a05:600c:2103:: with SMTP id u3mr13405879wml.150.1574370935642; Thu, 21 Nov 2019 13:15:35 -0800 (PST) Received: from ubuntu.home ([2a02:8071:6a3:700:d43f:27ce:888:835]) by smtp.gmail.com with ESMTPSA id g138sm1055844wmg.11.2019.11.21.13.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 13:15:35 -0800 (PST) From: Simon Goldschmidt To: Marek Vasut Date: Thu, 21 Nov 2019 22:15:23 +0100 Message-Id: <20191121211523.7219-2-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191121211523.7219-1-simon.k.r.goldschmidt@gmail.com> References: <20191121211523.7219-1-simon.k.r.goldschmidt@gmail.com> MIME-Version: 1.0 Cc: Heinrich Schuchardt , u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 2/2] usb: dwc2: fix possible alignment issues X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Acked-by: Lukasz Majewski --- 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"