From abad6211abfe5325beb34167e1700f361098483c Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Mon, 3 Dec 2012 13:23:12 -0800 Subject: [PATCH] compat: backport PTR_RET() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit mcgrof@frijol ~/linux-next (git::master)$ git describe --contains fa9ee9c4 v2.6.39-rc1~267 commit fa9ee9c4b9885dfdf8eccac19b8b4fc8a7c53288 Author: Uwe Kleine-König Date: Tue Mar 22 16:34:05 2011 -0700 include/linux/err.h: add a function to cast error-pointers to a return value PTR_RET() can be used if you have an error-pointer and are only interested in the eventual error value, but not the pointer. Yields the usual 0 for no error, -ESOMETHING otherwise. Signed-off-by: Uwe Kleine-König Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Luis R. Rodriguez --- include/linux/compat-2.6.39.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/compat-2.6.39.h b/include/linux/compat-2.6.39.h index e02ac9b6d4ae..8ff08ba3531b 100644 --- a/include/linux/compat-2.6.39.h +++ b/include/linux/compat-2.6.39.h @@ -8,6 +8,15 @@ #include #include #include +#include + +static inline int __must_check PTR_RET(const void *ptr) +{ + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; +} #define NETIF_F_RXCSUM 0 -- 2.30.2