From e7641b37f042e8476d1825a0043cc4dd9d665712 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Thu, 9 Jan 2014 16:12:52 -0800 Subject: [PATCH] Add declaration of PTR_ERR_OR_ZERO for kernels prior to 3.12 Signed-off-by: Guenter Roeck --- compat.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compat.h b/compat.h index de13589..0a46c0d 100644 --- a/compat.h +++ b/compat.h @@ -39,6 +39,14 @@ static void sysfs_remove_groups(struct kobject *kobj, sysfs_remove_group(kobj, groups[i]); } +static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) +{ + if (IS_ERR(ptr)) + return PTR_ERR(ptr); + else + return 0; +} + #endif #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 21) -- 2.39.5