include/linux/err.h: add a function to cast error-pointers to a return value
Changes
1 files changed · +8 −0
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| include/linux/err.h | modified | +8 | −0 | View file |
include/linux/err.h
View filediff --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 */