public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] usb: gadget: precedence bug in show_requests()
@ 2013-01-20 14:50 Dan Carpenter
  2013-01-20 17:10 ` Sergei Shtylyov
  2013-01-20 17:21 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-01-20 14:50 UTC (permalink / raw)
  To: kernel-janitors

The mod operation has higher precedence than the divide but the intent
was to divide first.  It's supposed to count through one time for RX
and a second time for TX but instead of doing "0 1 2 0 1 2" it does
"0 0 1 1 2 2".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff.  Untested.

diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index 3bc244d..3cd223c 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -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++)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] usb: gadget: precedence bug in show_requests()
  2013-01-20 14:50 [patch] usb: gadget: precedence bug in show_requests() Dan Carpenter
@ 2013-01-20 17:10 ` Sergei Shtylyov
  2013-01-20 17:21 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-01-20 17:10 UTC (permalink / raw)
  To: kernel-janitors

Hello.

On 20-01-2013 18:50, Dan Carpenter wrote:

> The mod operation has higher precedence than the divide

   They are of the same priority AFAIR, but that doesn't matter since these 
operations are executed left to right.

> but the intent
> was to divide first.  It's supposed to count through one time for RX
> and a second time for TX but instead of doing "0 1 2 0 1 2" it does
> "0 0 1 1 2 2".

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker stuff.  Untested.

> diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
> index 3bc244d..3cd223c 100644
> --- a/drivers/usb/chipidea/debug.c
> +++ b/drivers/usb/chipidea/debug.c
> @@ -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++)

WBR, Sergei


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] usb: gadget: precedence bug in show_requests()
  2013-01-20 14:50 [patch] usb: gadget: precedence bug in show_requests() Dan Carpenter
  2013-01-20 17:10 ` Sergei Shtylyov
@ 2013-01-20 17:21 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-01-20 17:21 UTC (permalink / raw)
  To: kernel-janitors

On Sun, Jan 20, 2013 at 09:10:24PM +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 20-01-2013 18:50, Dan Carpenter wrote:
> 
> >The mod operation has higher precedence than the divide
> 
>   They are of the same priority AFAIR, but that doesn't matter since
> these operations are executed left to right.
> 

Oh yeah, you're right.  I feel dumb now.  Let me resend with a
different changelog.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-20 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-20 14:50 [patch] usb: gadget: precedence bug in show_requests() Dan Carpenter
2013-01-20 17:10 ` Sergei Shtylyov
2013-01-20 17:21 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox