Commit a5ed3cee authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

err.h: use bool for IS_ERR and IS_ERR_OR_NULL

Use the more natural return of bool for these tests.

No difference observed in .o files produced by gcc for x86.

Remove the dentry description of kernel pointers left over from the 90's
and 2002's cleanup move of parts of fs.h to err.h.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8e3072a2
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
#define _LINUX_ERR_H #define _LINUX_ERR_H
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/types.h>
#include <asm/errno.h> #include <asm/errno.h>
/* /*
* Kernel pointers have redundant information, so we can use a * Kernel pointers have redundant information, so we can use a
* scheme where we can return either an error code or a dentry * scheme where we can return either an error code or a normal
* pointer with the same return value. * pointer with the same return value.
* *
* This should be a per-architecture thing, to allow different * This should be a per-architecture thing, to allow different
...@@ -29,12 +30,12 @@ static inline long __must_check PTR_ERR(__force const void *ptr) ...@@ -29,12 +30,12 @@ static inline long __must_check PTR_ERR(__force const void *ptr)
return (long) ptr; return (long) ptr;
} }
static inline long __must_check IS_ERR(__force const void *ptr) static inline bool __must_check IS_ERR(__force const void *ptr)
{ {
return IS_ERR_VALUE((unsigned long)ptr); return IS_ERR_VALUE((unsigned long)ptr);
} }
static inline long __must_check IS_ERR_OR_NULL(__force const void *ptr) static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
{ {
return !ptr || IS_ERR_VALUE((unsigned long)ptr); return !ptr || IS_ERR_VALUE((unsigned long)ptr);
} }
......
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