Skip to contentSkip to conversation

fix sparse warning in horizon atm driver.

PATCH Applied Dave Jones 3 participants 4 messages Nov 9, 2005 – Nov 10, 2005 ATM

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

these vars get fed u32's, and are OR'd with u32's. Chances are they were meant to be u32's.

I don't have hardware to test this, but I can't fathom why a u16 would be used here.

drivers/atm/horizon.c:1564:12: warning: cast truncates bits from constant value (40000000 becomes 0) drivers/atm/horizon.c:1565:12: warning: cast truncates bits from constant value (40000000 becomes 0) drivers/atm/horizon.c:1569:12: warning: cast truncates bits from constant value (80000000 becomes 0) drivers/atm/horizon.c:1570:12: warning: cast truncates bits from constant value (80000000 becomes 0)

drivers/atm/horizon.c renamed from drivers/atm/horizon.c~ +2 -2
@@ -1511,8 +1511,8 @@ static inline short setup_idle_tx_channe
     // a.k.a. prepare the channel and remember that we have done so.
     
     tx_ch_desc * tx_desc = &memmap->tx_descs[tx_channel];
-    u16 rd_ptr;
-    u16 wr_ptr;
+    u32 rd_ptr;
+    u32 wr_ptr;
     u16 channel = vcc->channel;
     
     unsigned long flags;
#1 lore raw

From: Dave Jones <[email protected]>
Date: Wed, 9 Nov 2005 00:57:39 -0500

Quoted 7 lines

these vars get fed u32's, and are OR'd with u32's. Chances are they were meant to be u32's.

I don't have hardware to test this, but I can't fathom why a u16 would be used here.

drivers/atm/horizon.c:1564:12: warning: cast truncates bits from constant value (40000000 becomes 0)

Hmmm... I would merge this directly, but I'd like Chas Williams (the ATM maintainer) to glance it over first. Can you forward it to him (CC:'ing the linux-atm list, also mentioned in MAINTAINERS, of course)? Thanks.

#2 lore raw
In reply to Dave Jones
Quoted 5 lines · In message <[email protected]>,Dave Jones writes:

these vars get fed u32's, and are OR'd with u32's. Chances are they were meant to be u32's.

I don't have hardware to test this, but I can't fathom why a u16 would be used here.

i guess someone got confused over BUFFER_PTR_MASK. this patch looks fine to me.

[ATM]: [horizon] fix sparse warnings

drivers/atm/horizon.c renamed from drivers/atm/horizon.c~ +2 -2
@@ -1511,8 +1511,8 @@ static inline short setup_idle_tx_channe
     // a.k.a. prepare the channel and remember that we have done so.
     
     tx_ch_desc * tx_desc = &memmap->tx_descs[tx_channel];
-    u16 rd_ptr;
-    u16 wr_ptr;
+    u32 rd_ptr;
+    u32 wr_ptr;
     u16 channel = vcc->channel;
     
     unsigned long flags;