Skip to content

Commit

Permalink
usb: host: oxu210hp-hcd: fix gcc warning
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200107214354.1008937-1-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Arnd Bergmann authored and Greg Kroah-Hartman committed Jan 8, 2020
1 parent 9521e47 commit 17da9b8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/usb/host/oxu210hp-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 17da9b8

Please sign in to comment.