Messages in this thread Patch in this message | | | From | Uwe Kleine-König <> | Subject | [PATCH] Add a function to cast error-pointers to a return value | Date | Wed, 26 Jan 2011 11:17:54 +0100 |
| |
Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- include/linux/err.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/include/linux/err.h b/include/linux/err.h index 448afc1..f2edce2 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -52,6 +52,14 @@ static inline void * __must_check ERR_CAST(const void *ptr) return (void *) ptr; } +static inline int __must_check PTR_RET(const void *ptr) +{ + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; +} + #endif #endif /* _LINUX_ERR_H */ -- 1.7.2.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |