usb: gadget: precedence bug in show_requests()
Subsystems (3)
PATCH v2 1/1 usb: gadget: precedence bug in show_requests()
The intent here was to have parenthesis around the (ci->hw_ep_max / 2) so that it counts like "0 1 2 0 1 2". In the current code, the mod operation happens first so it counts like "0 0 1 1 2 2".
Signed-off-by Dan Carpenter <[email protected]>
---
v2: fixed the changelog. mod and divide have the same precedence
drivers/usb/chipidea/debug.c +1 -1
@@ -709,7 +709,7 @@ static ssize_t show_requests(struct device *dev, struct device_attribute *attr, n +=scnprintf (buf + n,PAGE_SIZE - n,"EP=%02i: TD=%08X %s\n" , - i % ci->hw_ep_max/2 , (u32 )req->dma, + i % (ci->hw_ep_max /2 ), (u32 )req->dma, ((i < ci->hw_ep_max/2 ) ?"RX" :"TX" ));for (j =0 ; j < qSize; j++)
Quoted 5 lines · Dan Carpenter
The intent here was to have parenthesis around the (
ci->hw_ep_max/ 2) so that it counts like "0 1 2 0 1 2". In the current code, the mod operation happens first so it counts like "0 0 1 1 2 2".Signed-off-by Dan Carpenter <[email protected]>
Thanks, I added this one on top of my debug cleanup patchset [1].
[1] http://marc.info/?l=linux-usb&m5902438408860&w=2
Regards,
--
Alex