Re: [PATCH v3 1/4] net/macb: fix truncate warnings

From
Joachim Eastwood <hidden>
Date
2012-10-23 17:20:26
Also in
linux-arm-kernel
Reply to
Lothar Waßmann, 2012-10-23
On Tue, Oct 23, 2012 at 2:00 PM, Lothar Waßmann [off-list ref] wrote:
Hi,

David Miller writes:
quoted
From: "David Laight" <redacted>
Date: Tue, 23 Oct 2012 09:21:11 +0100
quoted
quoted
When building macb on x86_64 the following warnings show up:
  drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
  drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
...
quoted
-                  macb_writel(bp, IDR, ~0UL);
+                  macb_writel(bp, IDR, -1);
Seems wrong to fix an error with an unsigned value
by using -1.
-1 is equally an unsigned value of all 1's and completely legitimate.
The correction being made here is one of size not signedness.
You could use '~0' (without the 'UL').
The reason for choosing '-1', as noted in patch description, is that
it already appears in a couple of other places in the driver. So I
though it would nice to be consistent.

regards
Joachim Eastwood
Thread (10 messages) 10 messages, 4 authors, last reply 2012-10-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help