mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
UPSTREAM: usb: dwc3: gadget: Fix truncated cast issue
From sparse:
warning: cast truncates bits from constant value (100 becomes 0)
The DWC3_TRB_NUM constant is too big for u8. Do the calculation a
slightly different way that should still be optimized out for the case
where DWC3_TRB_NUM == 256.
Change-Id: If6f9d66a7545230b0d0f21ab05dacd0f572f10b6
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit 3de2685f0c)
This commit is contained in:
@@ -882,7 +882,7 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
|
||||
}
|
||||
|
||||
trbs_left = dep->trb_dequeue - dep->trb_enqueue;
|
||||
trbs_left %= DWC3_TRB_NUM;
|
||||
trbs_left &= (DWC3_TRB_NUM - 1);
|
||||
|
||||
if (dep->trb_dequeue < dep->trb_enqueue)
|
||||
trbs_left--;
|
||||
|
||||
Reference in New Issue
Block a user