LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] usb: host: oxu210hp-hcd: fix gcc warning
@ 2020-01-07 21:43 Arnd Bergmann
  0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2020-01-07 21:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Oleksandr Natalenko, Arnd Bergmann, Colin Ian King, YueHaibing,
	Masahiro Yamada, Ben Dooks (Codethink),
	linux-usb, linux-kernel

gcc -O3 warns about correct code:

    inlined from 'oxu_hub_control.constprop' at drivers/usb/host/oxu210hp-hcd.c:3652:3:
include/linux/string.h:411:9: error: argument 1 null where non-null expected [-Werror=nonnull]
  return __builtin_memset(p, c, size);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/host/oxu210hp-hcd.c: In function 'oxu_hub_control.constprop':
include/linux/string.h:411:9: note: in a call to built-in function '__builtin_memset'

Expand the code slightly to let gcc better understand it and
not warn any more.

Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/oxu210hp-hcd.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index fe09b8626329..120666a0d590 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -2783,11 +2783,15 @@ static void ehci_port_power(struct oxu_hcd *oxu, int is_on)
 		return;
 
 	oxu_dbg(oxu, "...power%s ports...\n", is_on ? "up" : "down");
-	for (port = HCS_N_PORTS(oxu->hcs_params); port > 0; )
-		(void) oxu_hub_control(oxu_to_hcd(oxu),
-				is_on ? SetPortFeature : ClearPortFeature,
-				USB_PORT_FEAT_POWER,
-				port--, NULL, 0);
+	for (port = HCS_N_PORTS(oxu->hcs_params); port > 0; ) {
+		if (is_on)
+			oxu_hub_control(oxu_to_hcd(oxu), SetPortFeature,
+				USB_PORT_FEAT_POWER, port--, NULL, 0);
+		else
+			oxu_hub_control(oxu_to_hcd(oxu), ClearPortFeature,
+				USB_PORT_FEAT_POWER, port--, NULL, 0);
+	}
+
 	msleep(20);
 }
 
-- 
2.20.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-07 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 21:43 [PATCH] usb: host: oxu210hp-hcd: fix gcc warning Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).