OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Nicer WARN_ON in netstat_show
[PATCH] Nicer WARN_ON in netstat_show [message #23871] Wed, 28 November 2007 10:11 Go to previous message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
The

	if (statement)
		WARN_ON(1);

looks much better as

	WARN_ON(statement);

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 61ead1d..e41f4b9 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -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 &&
 
Read Message
Read Message
Previous Topic: [PATCH] Fix inet_diag.ko register vs rcv race
Next Topic: [patch -mm 2/4] mqueue namespace : add unshare support
Goto Forum:
  


Current Time: Mon Aug 25 17:16:41 GMT 2025

Total time taken to generate the page: 0.14586 seconds