]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[LLC]: Fix compiler warnings introduced by TX window scaling changes.
authorDavid S. Miller <davem@sunset.davemloft.net>
Thu, 17 Nov 2005 23:17:42 +0000 (15:17 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 17 Nov 2005 23:17:42 +0000 (15:17 -0800)
Noticed by Olaf Hering.

The comparisons want a u8 here (the data type on the left-hand branch
is a u8 structure member, and the constant on the right-hand branch is
"~((u8) 128)"), but C turns it into an integer so we get:

net/llc/llc_c_ac.c: In function `llc_conn_ac_inc_npta_value':
net/llc/llc_c_ac.c:998: warning: comparison is always true due to limited range of data type
net/llc/llc_c_ac.c:999: warning: large integer implicitly truncated to unsigned type

Fix this up by explicitly recasting the right-hand branch constant
into a "u8" once more.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/llc/llc_c_ac.c

index 91fb6bc1b11690810272b8d806d565e21d7e4eb6..8169f24ed33e51649c9c8c80f27f3fa9dc88c3a7 100644 (file)
@@ -995,8 +995,8 @@ static int llc_conn_ac_inc_npta_value(struct sock *sk, struct sk_buff *skb)
                llc->dec_step = 0;
                llc->dec_cntr = llc->inc_cntr = 2;
                ++llc->npta;
-               if (llc->npta > ~LLC_2_SEQ_NBR_MODULO)
-                       llc->npta = ~LLC_2_SEQ_NBR_MODULO ;
+               if (llc->npta > (u8) ~LLC_2_SEQ_NBR_MODULO)
+                       llc->npta = (u8) ~LLC_2_SEQ_NBR_MODULO;
        } else
                --llc->inc_cntr;
        return 0;
@@ -1086,8 +1086,8 @@ int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct sk_buff *skb)
        struct llc_sock *llc = llc_sk(sk);
 
        llc->k += 1;
-       if (llc->k > ~LLC_2_SEQ_NBR_MODULO)
-               llc->k = ~LLC_2_SEQ_NBR_MODULO ;
+       if (llc->k > (u8) ~LLC_2_SEQ_NBR_MODULO)
+               llc->k = (u8) ~LLC_2_SEQ_NBR_MODULO;
        return 0;
 }