[PATCH] drivers: staging: dgrp: type issue, unsigned number decreasing unsigned number will always be >= 0

Chen Gang gang.chen at asianux.com
Wed Jun 5 00:58:27 UTC 2013


The original author wanted to 'compare' between 'jiffies' and
'ch->ch_waketime', but both of them are unsigned, so the original
'comparation' is always true.

The related warning (with 'EXTRA_CFLAGS=-W')
  drivers/staging/dgrp/dgrp_net_ops.c:1610:10: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]


Signed-off-by: Chen Gang <gang.chen at asianux.com>
---
 drivers/staging/dgrp/dgrp_net_ops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c
index 7a0d72d..120c55a 100644
--- a/drivers/staging/dgrp/dgrp_net_ops.c
+++ b/drivers/staging/dgrp/dgrp_net_ops.c
@@ -1607,7 +1607,7 @@ static int dgrp_send(struct nd_struct *nd, long tmax)
 					if ((ch->ch_pun.un_flag & UN_LOW) != 0 ?
 					    (n <= TBUF_LOW) :
 					    (ch->ch_pun.un_flag & UN_TIME) != 0 ?
-					    ((jiffies - ch->ch_waketime) >= 0) :
+					    (jiffies >= ch->ch_waketime) :
 					    (n == 0 && ch->ch_s_tpos == ch->ch_s_tin) &&
 					    ((ch->ch_pun.un_flag & UN_EMPTY) != 0 ||
 					    ((ch->ch_tun.un_open_count &&
-- 
1.7.7.6



More information about the devel mailing list