[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1296037074-1585-1-git-send-email-u.kleine-koenig@pengutronix.de>
Date: Wed, 26 Jan 2011 11:17:54 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] Add a function to cast error-pointers to a return value
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists