summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2014-04-25 14:18:13 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-25 14:56:16 -0700
commitd5dbd3f7d82223b59dc2200c0e9f4f95665a21a4 (patch)
treefe6d0973a037164794a0bee13e873c8766381dd8 /drivers/usb/dwc2
parent8355d39cc2128c80fd58309fdca825b1444bf067 (diff)
downloadop-kernel-dev-d5dbd3f7d82223b59dc2200c0e9f4f95665a21a4.zip
op-kernel-dev-d5dbd3f7d82223b59dc2200c0e9f4f95665a21a4.tar.gz
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 <fengguang.wu@intel.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r--drivers/usb/dwc2/gadget.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index dc0faee..2057c38 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);
OpenPOWER on IntegriCloud