From: Paul Zimmerman Date: Fri, 25 Apr 2014 21:18:13 +0000 (-0700) Subject: usb: dwc2: fix sparse warning X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d5dbd3f7d82223b59dc2200c0e9f4f95665a21a4;p=linux-beck.git usb: dwc2: fix sparse warning Sparse warns about the __le16 wValue from the USB SetAddress command being used without converting it to CPU endianness. Fix that, and also add a bit of defensive masking of the received wValue before using it. Reported-by: Fengguang Wu Signed-off-by: Paul Zimmerman Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index dc0faee031fb..2057c380969e 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1094,7 +1094,8 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, s3c_hsotg_disconnect(hsotg); dcfg = readl(hsotg->regs + DCFG); dcfg &= ~DCFG_DEVADDR_MASK; - dcfg |= ctrl->wValue << DCFG_DEVADDR_SHIFT; + dcfg |= (le16_to_cpu(ctrl->wValue) << + DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK; writel(dcfg, hsotg->regs + DCFG); dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);