From 444f3179c3921bf725459e41848425468662c852 Mon Sep 17 00:00:00 2001 From: Elson Roy Serrao Date: Wed, 24 Mar 2021 16:36:23 -0700 Subject: [PATCH] usb: dwc3: correct the super speed check api When the device operates in full speed mode, the CONNECTSPD field vaue is 1. Using bitwise & operator on this value for super speed check results in full speed being erroneously calculated as super speed. Fix this by comparing the absolute value of CONNECTSPD for super speed check. Change-Id: I2bf497748f621b1982aecda55a9a280d93f84858 Signed-off-by: Elson Roy Serrao --- drivers/usb/dwc3/dwc3-msm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 1f98f69ef4ca..963df6caf1f7 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -760,8 +760,8 @@ static inline bool dwc3_msm_is_dev_superspeed(struct dwc3_msm *mdwc) u8 speed; speed = dwc3_msm_read_reg(mdwc->base, DWC3_DSTS) & DWC3_DSTS_CONNECTSPD; - if ((speed & DWC3_DSTS_SUPERSPEED) || - (speed & DWC3_DSTS_SUPERSPEED_PLUS)) { + if ((speed == DWC3_DSTS_SUPERSPEED) || + (speed == DWC3_DSTS_SUPERSPEED_PLUS)) { mdwc->ss_phy->flags |= DEVICE_IN_SS_MODE; return true; }