]> git.hungrycats.org Git - linux/commitdiff
[PATCH] mark IS_ERR as unlikely()
authorAndrew Morton <akpm@osdl.org>
Mon, 23 Aug 2004 06:04:49 +0000 (23:04 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 23 Aug 2004 06:04:49 +0000 (23:04 -0700)
It seems fair to assume that it is always unlikely that IS_ERR will return
true.

This patch changes the gcc-3.4-generated kernel text by ~500 bytes (less) so
it's fair to assume that the compiler is indeed propagating unlikeliness out
of inline functions.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/err.h

index 92cab64fdd837fb1f7c357404586e24ce46f3029..17c55df13615a9bda172e80c6f4711c11f3183e8 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_ERR_H
 #define _LINUX_ERR_H
 
+#include <linux/compiler.h>
+
 #include <asm/errno.h>
 
 /*
@@ -23,7 +25,7 @@ static inline long PTR_ERR(const void *ptr)
 
 static inline long IS_ERR(const void *ptr)
 {
-       return (unsigned long)ptr > (unsigned long)-1000L;
+       return unlikely((unsigned long)ptr > (unsigned long)-1000L);
 }
 
 #endif /* _LINUX_ERR_H */