]> git.sur5r.net Git - groeck-nct6775/commitdiff
Add declaration of PTR_ERR_OR_ZERO for kernels prior to 3.12
authorGuenter Roeck <linux@roeck-us.net>
Fri, 10 Jan 2014 00:12:52 +0000 (16:12 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 10 Jan 2014 00:12:52 +0000 (16:12 -0800)
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
compat.h

index de13589e82a9daa0b0e1e27c149f412b09b56672..0a46c0d8d998807c020be5e626dca72497b3c908 100644 (file)
--- 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)