mirror of
https://xff.cz/git/u-boot/
synced 2025-09-06 11:12:05 +02:00
log: Add a way to log a return value with a message
It is sometimes useful to show a message when logging an error return value, perhaps to add a few details about the problem. Add a function to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -166,8 +166,16 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line,
|
|||||||
log(LOG_CATEGORY, LOGL_ERR, "returning err=%d\n", __ret); \
|
log(LOG_CATEGORY, LOGL_ERR, "returning err=%d\n", __ret); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
#define log_msg_ret(_msg, _ret) ({ \
|
||||||
|
int __ret = (_ret); \
|
||||||
|
if (__ret < 0) \
|
||||||
|
log(LOG_CATEGORY, LOGL_ERR, "%s: returning err=%d\n", _msg, \
|
||||||
|
__ret); \
|
||||||
|
__ret; \
|
||||||
|
})
|
||||||
#else
|
#else
|
||||||
#define log_ret(_ret) (_ret)
|
#define log_ret(_ret) (_ret)
|
||||||
|
#define log_msg_ret(_ret) (_ret)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user