[PATCH 1/5] usb: dwc2: Make dwc2_wait_bit_set wait all bits in mask

Jules Maselbas jmaselbas at kalray.eu
Fri Mar 12 16:24:28 GMT 2021


The dwc2_wait_bit_set() wasn't waiting for all bits in the mask to be
set but was waiting for only one bit set a mask.
This is not the expected behavior as stated in the function's comment.

The function dwc2_wait_bit_set() is always called with a mask of only
one bit.

Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
---
 drivers/usb/dwc2/core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 780efb262..fa9d6ae95 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -532,7 +532,7 @@ static inline int dwc2_wait_bit_set(struct dwc2 *dwc2, u32 offset, u32 mask,
 			    u32 timeout)
 {
 	return wait_on_timeout(timeout * USECOND,
-			dwc2_readl(dwc2, offset) & mask);
+			(dwc2_readl(dwc2, offset) & mask) == mask);
 }
 
 /**
-- 
2.17.1





More information about the barebox mailing list