2005-11-09 05:57:45

by Dave Jones

[permalink] [raw]
Subject: fix sparse warning in horizon atm driver.

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)

Signed-off-by: Dave Jones <[email protected]>

--- linus/drivers/atm/horizon.c~ 2005-11-09 00:51:50.000000000 -0500
+++ linus/drivers/atm/horizon.c 2005-11-09 00:55:36.000000000 -0500
@@ -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;


2005-11-09 21:07:16

by David Miller

[permalink] [raw]
Subject: Re: fix sparse warning in horizon atm driver.

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

> 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.

Subject: Re: fix sparse warning in horizon atm driver.

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

Signed-off-by: Dave Jones <[email protected]>
Signed-off-by: Chas Williams <[email protected]>

--- linus/drivers/atm/horizon.c~ 2005-11-09 00:51:50.000000000 -0500
+++ linus/drivers/atm/horizon.c 2005-11-09 00:55:36.000000000 -0500
@@ -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;

2005-11-10 20:57:27

by David Miller

[permalink] [raw]
Subject: Re: fix sparse warning in horizon atm driver.

From: "chas williams - CONTRACTOR" <[email protected]>
Date: Thu, 10 Nov 2005 11:00:39 -0500

> [ATM]: [horizon] fix sparse warnings
>
> Signed-off-by: Dave Jones <[email protected]>
> Signed-off-by: Chas Williams <[email protected]>

Applied, thanks everyone.