aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-07-15 11:19:32 +0930
committerMark Brown <broonie@kernel.org>2015-01-23 12:38:36 +0000
commit94d512cdf3d7222736b2ce256c61c5baa5d39a55 (patch)
tree37451a92d584aaacb93d0f89a03bf8c533a7df4c
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff)
downloadlinux-linaro-stable-v3.10/topic/ptr-err.tar.gz
PTR_RET is now PTR_ERR_OR_ZEROv3.10/topic/ptr-err
True, it's often used in return statements, but after much bikeshedding it's probably better to have an explicit name. (I tried just putting the IS_ERR check inside PTR_ERR itself and gcc usually generated no more code. But that clashes current expectations of how PTR_ERR behaves, so having a separate function is better). Suggested-by: Julia Lawall <julia.lawall@lip6.fr> Suggested-by: "Michael S. Tsirkin" <mst@redhat.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cherry picked from commit 6e8b8726ad503214ba66e34aed69aff41de33489) Signed-off-by: Mark Brown <broonie@kernel.org> Conflicts: include/linux/err.h
-rw-r--r--include/linux/err.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/err.h b/include/linux/err.h
index f2edce2..480cdf3 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -52,7 +52,7 @@ static inline void * __must_check ERR_CAST(const void *ptr)
return (void *) ptr;
}
-static inline int __must_check PTR_RET(const void *ptr)
+static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
{
if (IS_ERR(ptr))
return PTR_ERR(ptr);
@@ -60,6 +60,9 @@ static inline int __must_check PTR_RET(const void *ptr)
return 0;
}
+/* Deprecated */
+#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
+
#endif
#endif /* _LINUX_ERR_H */