Skip to contentSkip to conversation

Nicer WARN_ON in netstat_show

PATCH Applied Pavel Emelyanov 2 participants 2 messages Nov 28, 2007 – Nov 29, 2007

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

PATCH 1/1 Nicer WARN_ON in netstat_show

The

	if (statement)
		WARN_ON(1);

looks much better as

	WARN_ON(statement);

---

net/core/net-sysfs.c +2 -3
index 61ead1d..e41f4b9 100644
@@ -247,9 +247,8 @@ static ssize_t netstat_show(const struct device *d,
 	struct net_device_stats *stats;
 	ssize_t ret = -EINVAL;
 
-	if (offset > sizeof(struct net_device_stats) ||
-	    offset % sizeof(unsigned long) != 0)
-		WARN_ON(1);
+	WARN_ON(offset > sizeof(struct net_device_stats) ||
+			offset % sizeof(unsigned long) != 0);
 
 	read_lock(&dev_base_lock);
 	if (dev_isalive(dev) && dev->get_stats &&
Applied
#1 lore raw
Quoted 10 lines · Pavel Emelyanov

The

	if (statement)
		WARN_ON(1);

looks much better as

	WARN_ON(statement);

Applied to net-2.6.25. Thanks.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt