mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 13:52:50 +01:00
PTR_RET is now PTR_ERR_OR_ZERO
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 <[email protected]> Suggested-by: "Michael S. Tsirkin" <[email protected]> Cc: Julia Lawall <[email protected]> Cc: "Michael S. Tsirkin" <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
This commit is contained in:
1 parent
ad81f0545e
commit
6e8b8726ad
1 file changed
+4
-1
+4
-1
@@ -52,7 +52,7 @@ static inline void * __must_check ERR_CAST(__force const void *ptr)
|
||||
return (void *) ptr;
|
||||
}
|
||||
|
||||
static inline int __must_check PTR_RET(__force 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(__force const void *ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deprecated */
|
||||
#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_ERR_H */
|
||||
Reference in new issue
Block a user