diff mbox series

[02/11] dwc3: debug: fix sparse warning

Message ID 20200813062532.829720-2-balbi@kernel.org
State New
Headers show
Series None | expand

Commit Message

Felipe Balbi Aug. 13, 2020, 6:25 a.m. UTC
From: Felipe Balbi <balbi@kernel.org>

Fix the following sparse warning:

drivers/usb/dwc3/trace.c: note: in included file (through drivers/usb/dwc3/trace.h):
drivers/usb/dwc3/debug.h:374:39: warning: cast to non-scalar

Signed-off-by: Felipe Balbi <balbi@kernel.org>
 drivers/usb/dwc3/debug.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
index 3d16dac4e5cc..8e03bcb77da8 100644
--- a/drivers/usb/dwc3/debug.h
+++ b/drivers/usb/dwc3/debug.h
@@ -371,7 +371,9 @@  static inline const char *dwc3_gadget_event_type_string(u8 event)
 static inline const char *dwc3_decode_event(char *str, size_t size, u32 event,
 		u32 ep0state)
-	const union dwc3_event evt = (union dwc3_event) event;
+	union dwc3_event evt;
+	memcpy(&evt, &event, sizeof(event));
 	if (evt.type.is_devspec)
 		return dwc3_gadget_event_string(str, size, &evt.devt);