Update _log function to drop any traces when log is yet initialized:
vsnprintf is no more executed in this case.
This patch allows to reduce the cost for the dropped early debug trace.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
struct log_rec rec;
va_list args;
+ if (!gd)
+ return -ENOSYS;
+
/* Check for message continuation */
if (cat == LOGC_CONT)
cat = gd->logc_prev;
rec.file = file;
rec.line = line;
rec.func = func;
+
+ if (!(gd->flags & GD_FLG_LOG_READY)) {
+ gd->log_drop_count++;
+ return -ENOSYS;
+ }
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
rec.msg = buf;
- if (!gd || !(gd->flags & GD_FLG_LOG_READY)) {
- if (gd)
- gd->log_drop_count++;
- return -ENOSYS;
- }
if (!log_dispatch(&rec)) {
gd->logc_prev = cat;
gd->logl_prev = level;