9
0
Fork 0

err.h: Add PTR_ERR_OR_ZERO from kernel

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-12-10 15:22:13 +01:00
parent 4449fac898
commit b657881071
1 changed files with 8 additions and 0 deletions

View File

@ -52,6 +52,14 @@ static inline void *ERR_CAST(const void *ptr)
return (void *) ptr;
}
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
#endif /* _LINUX_ERR_H */