putting an error pointer into strerror can be a bit confusing since strerror takes a positive error code but PTR_ERR returns a negative number, so we have to do strerror(-PTR_ERR(errp)). Some places got this wrong already, so introduce a strerrorp function which directly takes an error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
19 lines
319 B
C
19 lines
319 B
C
#ifndef __ERRNO_H
|
|
#define __ERRNO_H
|
|
|
|
#include <asm-generic/errno.h>
|
|
#include <linux/err.h>
|
|
|
|
extern int errno;
|
|
|
|
void perror(const char *s);
|
|
const char *errno_str(void);
|
|
const char *strerror(int errnum);
|
|
|
|
static inline const char *strerrorp(const void *errp)
|
|
{
|
|
return strerror(-PTR_ERR(errp));
|
|
}
|
|
|
|
#endif /* __ERRNO_H */
|