Commit 3b0b17a8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mark IS_ERR as unlikely()

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: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 17ccf8a6
#ifndef _LINUX_ERR_H #ifndef _LINUX_ERR_H
#define _LINUX_ERR_H #define _LINUX_ERR_H
#include <linux/compiler.h>
#include <asm/errno.h> #include <asm/errno.h>
/* /*
...@@ -23,7 +25,7 @@ static inline long PTR_ERR(const void *ptr) ...@@ -23,7 +25,7 @@ static inline long PTR_ERR(const void *ptr)
static inline long IS_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 */ #endif /* _LINUX_ERR_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment