]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] consistently use MAX_ERRNO in __syscall_return
authorRandy Dunlap <rdunlap@xenotime.net>
Wed, 27 Sep 2006 08:50:55 +0000 (01:50 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 27 Sep 2006 15:26:18 +0000 (08:26 -0700)
Consistently use MAX_ERRNO when checking for errors in __syscall_return().

[ralf@linux-mips.org: build fix]
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
14 files changed:
include/asm-arm/unistd.h
include/asm-arm26/unistd.h
include/asm-frv/unistd.h
include/asm-h8300/unistd.h
include/asm-i386/unistd.h
include/asm-m32r/unistd.h
include/asm-m68k/unistd.h
include/asm-m68knommu/unistd.h
include/asm-s390/unistd.h
include/asm-sh/unistd.h
include/asm-sh64/unistd.h
include/asm-v850/unistd.h
include/asm-x86_64/unistd.h
include/linux/err.h

index 1e891f860ef3ef4f430d6757dc7c6786977de882..2ab4078334bf1ee57afba6e6ffa7639903dd6889 100644 (file)
 #endif
 
 #ifdef __KERNEL__
+#include <linux/err.h>
 #include <linux/linkage.h>
 
 #define __sys2(x) #x
 
 #define __syscall_return(type, res)                                    \
 do {                                                                   \
-       if ((unsigned long)(res) >= (unsigned long)(-129)) {            \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) {      \
                errno = -(res);                                         \
                res = -1;                                               \
        }                                                               \
index 70eb6d91cfd0c85448477479fa0d2fca848dfaf9..c6d2436c9d349ca322790a81fe95181988641da0 100644 (file)
 #define __ARM_NR_usr26                 (__ARM_NR_BASE+3)
 
 #ifdef __KERNEL__
+#include <linux/err.h>
 #include <linux/linkage.h>
 
 #define __sys2(x) #x
 
 #define __syscall_return(type, res)                                    \
 do {                                                                   \
-       if ((unsigned long)(res) >= (unsigned long)(-125)) {            \
+       if ((unsigned long)(res) >= (unsigned long)-MAX_ERRNO) {        \
                errno = -(res);                                         \
                res = -1;                                               \
        }                                                               \
index b80dbd839475677b1c5721a9d5033875ee20770d..d104d1b91d399bb4f34f627b478f8740ebbee662 100644 (file)
 #ifdef __KERNEL__
 
 #define NR_syscalls 310
+#include <linux/err.h>
 
 /*
  * process the return value of a syscall, consigning it to one of two possible fates
 #define __syscall_return(type, res)                                    \
 do {                                                                   \
         unsigned long __sr2 = (res);                                   \
-       if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) {     \
+       if (__builtin_expect(__sr2 >= (unsigned long)(-MAX_ERRNO), 0)) { \
                errno = (-__sr2);                                       \
                __sr2 = ~0UL;                                           \
        }                                                               \
index 226dd596c2dad0de1e22943ba1853610c7c8cb20..a2dd90462d80f172b17760b1501dfd6c91e3030d 100644 (file)
 #ifdef __KERNEL__
 
 #define NR_syscalls 289
+#include <linux/err.h>
 
-
-/* user-visible error numbers are in the range -1 - -122: see
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
    <asm-m68k/errno.h> */
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
        /* avoid using res which is declared to be in register d0; \
           errno might expand to a function call and clobber it.  */ \
                int __err = -(res); \
index 565d0897b2053d274f279f6bb2d4d2b614a92670..bd9987087adc6adb90d95daabf67c4eba7be8392 100644 (file)
 #ifdef __KERNEL__
 
 #define NR_syscalls 319
+#include <linux/err.h>
 
 /*
- * user-visible error numbers are in the range -1 - -128: see
+ * user-visible error numbers are in the range -1 - -MAX_ERRNO: see
  * <asm-i386/errno.h>
  */
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
                errno = -(res); \
                res = -1; \
        } \
index 89f376e6229f7ddb2cf332a613177e9f09f1b19a..5c6a9ac6cf1aea11eefcca4969dae98057e6c724 100644 (file)
 #ifdef __KERNEL__
 
 #define NR_syscalls 285
+#include <linux/err.h>
 
-/* user-visible error numbers are in the range -1 - -124: see
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
  * <asm-m32r/errno.h>
  */
 
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-(124 + 1))) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
        /* Avoid using "res" which is declared to be in register r0; \
           errno might expand to a function call and clobber it.  */ \
                int __err = -(res); \
index 7c0b6296b45c6b8c14cd545deb9a565b5db78f0d..751632b904dbca90a4e8a1967ff24a28815d9532 100644 (file)
 #ifdef __KERNEL__
 
 #define NR_syscalls            282
+#include <linux/err.h>
 
-/* user-visible error numbers are in the range -1 - -124: see
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
    <asm-m68k/errno.h> */
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
        /* avoid using res which is declared to be in register d0; \
           errno might expand to a function call and clobber it.  */ \
                int __err = -(res); \
index 1b2abdf281e1800b62f66bdda3b7ff9a9057bfb9..21fdc37c5c2c60c8c4e69d0a6829efa297042dc9 100644 (file)
 #ifdef __KERNEL__
 
 #define NR_syscalls            282
+#include <linux/err.h>
 
-/* user-visible error numbers are in the range -1 - -122: see
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
    <asm-m68k/errno.h> */
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
        /* avoid using res which is declared to be in register d0; \
           errno might expand to a function call and clobber it.  */ \
                int __err = -(res); \
index 02b942d85c377369abea006db9d932bef89b1cce..d49c54cb5505a03d8ee8920af9e2d08f662bbffd 100644 (file)
 
 #ifdef __KERNEL__
 
+#include <linux/err.h>
+
 #define __syscall_return(type, res)                         \
 do {                                                        \
-       if ((unsigned long)(res) >= (unsigned long)(-4095)) {\
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
                errno = -(res);                              \
                res = -1;                                    \
        }                                                    \
index 76b5430cb4580ae09995ce8979a078ceb4ba84e9..da127d7901af40c825f7ac20ad362c254105fc81 100644 (file)
 
 #ifdef __KERNEL__
 
-/* user-visible error numbers are in the range -1 - -124: see <asm-sh/errno.h> */
+#include <linux/err.h>
+
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
+ * see <asm-sh/errno.h> */
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-124)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
        /* Avoid using "res" which is declared to be in register r0; \
           errno might expand to a function call and clobber it.  */ \
                int __err = -(res); \
index 9a1590fffc1533d86ef6f1c670df551b7874f4d4..c113566bef3320b348f337a684688323b3e723f6 100644 (file)
 #ifdef __KERNEL__ 
 
 #define NR_syscalls 321
+#include <linux/err.h>
 
-/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
+ * see <asm-sh64/errno.h> */
 
 #define __syscall_return(type, res) \
 do { \
@@ -358,7 +360,7 @@ do { \
        **       life easier in the system call epilogue (see entry.S)      \
        */                                                                  \
         register unsigned long __sr2 __asm__ ("r2") = res;                 \
-       if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) {          \
                errno = -(res);                                             \
                __sr2 = -1;                                                 \
        } \
index bcb44bfe577a58c257b22d591ce9840427e74821..552b7c873a5702790d913ed85a4270baa4b3455e 100644 (file)
 #ifdef __KERNEL__
 
 #include <asm/clinkage.h>
+#include <linux/err.h>
 
 #define __syscall_return(type, res)                                          \
   do {                                                                       \
-         /* user-visible error numbers are in the range -1 - -124:           \
+         /* user-visible error numbers are in the range -1 - -MAX_ERRNO:      \
             see <asm-v850/errno.h> */                                        \
-         if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-125), 0)) { \
+         if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO), 0)) { \
                  errno = -(res);                                             \
                  res = -1;                                                   \
          }                                                                   \
index eeb98c168e98eaff463a21e2629d575690022d8e..6137146516d3905ef58c931f56fc7951a26ad194 100644 (file)
@@ -623,16 +623,17 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
 #ifdef __KERNEL__
 
 #define __NR_syscall_max __NR_move_pages
+#include <linux/err.h>
 
 #ifndef __NO_STUBS
 
-/* user-visible error numbers are in the range -1 - -4095 */
+/* user-visible error numbers are in the range -1 - -MAX_ERRNO */
 
 #define __syscall_clobber "r11","rcx","memory" 
 
 #define __syscall_return(type, res) \
 do { \
-       if ((unsigned long)(res) >= (unsigned long)(-127)) { \
+       if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
                errno = -(res); \
                res = -1; \
        } \
index cd3b367f7445e5aa0f25ddbf2f0b96c44a19b94f..1ab1d44f8d3be7a28c8a1a849c72e1f841424015 100644 (file)
@@ -15,6 +15,8 @@
  */
 #define MAX_ERRNO      4095
 
+#ifndef __ASSEMBLY__
+
 #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
 
 static inline void *ERR_PTR(long error)
@@ -32,4 +34,6 @@ static inline long IS_ERR(const void *ptr)
        return IS_ERR_VALUE((unsigned long)ptr);
 }
 
+#endif
+
 #endif /* _LINUX_ERR_H */