Skip to contentSkip to conversation

wireless: remove redundant tests on unsigned

PATCH In review Roel Kluin 2 participants 2 messages Jun 22, 2009 Networking drivers (wireless)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 wireless: remove redundant tests on unsigned

bufsize and remainder are unsigned. When negative they are wrapped and caught by the other test.

---
 drivers/net/wireless/orinoco/hermes.c      |    2 +-
 drivers/net/wireless/rtl818x/rtl8180_dev.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/orinoco/hermes.c +1 -1
index f2c918c..1a2fca7 100644
@@ -469,7 +469,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
 	u16 rlength, rtype;
 	unsigned nwords;
 
-	if ((bufsize < 0) || (bufsize % 2))
+	if (bufsize % 2)
 		return -EINVAL;
 
 	err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL);
drivers/net/wireless/rtl818x/rtl8180_dev.c +1 -1
index 7e65d7c..870fb98 100644
@@ -280,7 +280,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 				(ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
 		remainder = (16 * (skb->len + 4)) %
 			    ((ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
-		if (remainder > 0 && remainder <= 6)
+		if (remainder <= 6)
 			plcp_len |= 1 << 15;
 	}
 
#1 lore raw
Quoted 2 lines · Roel Kluin

bufsize and remainder are unsigned. When negative they are wrapped and caught by the other test.

For hermes.c:

Signature · 2 lines
Regards,
Pavel Roskin