Skip to contentSkip to conversation

ipw2x00: clean up a condition

PATCH In review Dan Carpenter 2 participants 2 messages Oct 9, 2014 – Oct 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ipw2x00: clean up a condition

The original condition was "(PAGE_SIZE - len)" when "(len < PAGE_SIZE)" is intended.

This condition is not really sufficient, but also not really needed... If "len > PAGE_SIZE" then it we will print a warning message in dmesg but there are no other effects. Maybe we should just remove the condition?

drivers/net/wireless/ipw2x00/ipw2200.c +1 -1
index edc3443..67cad9b 100644
@@ -1363,7 +1363,7 @@ static ssize_t show_cmd_log(struct device *d,
 	if (!priv->cmdlog)
 		return 0;
 	for (i = (priv->cmdlog_pos + 1) % priv->cmdlog_len;
-	     (i != priv->cmdlog_pos) && (PAGE_SIZE - len);
+	     (i != priv->cmdlog_pos) && (len < PAGE_SIZE);
 	     i = (i + 1) % priv->cmdlog_len) {
 		len + 		    snprintf(buf + len, PAGE_SIZE - len,
#1 lore raw

Hello Dan,

Quoted 9 lines · Dan Carpenter

The original condition was "(PAGE_SIZE - len)" when "(len < PAGE_SIZE)" is intended.

This condition is not really sufficient, but also not really needed... If "len > PAGE_SIZE" then it we will print a warning message in dmesg but there are no other effects. Maybe we should just remove the condition?

Looks fine, thanks.

Stanislav.