From c9ca1139e9fa5bc856d704ab60bcd7730a908b25 Mon Sep 17 00:00:00 2001 From: Emmanuel Blot Date: Mon, 27 Nov 2023 19:46:24 +0100 Subject: [PATCH] [ot] hw/opentitan: ot_ibex_wrapper: fix lint warning Signed-off-by: Emmanuel Blot --- hw/opentitan/ot_ibex_wrapper_darjeeling.c | 2 +- hw/opentitan/ot_ibex_wrapper_earlgrey.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/opentitan/ot_ibex_wrapper_darjeeling.c b/hw/opentitan/ot_ibex_wrapper_darjeeling.c index fe686931cf7b..1eb95c4e4cfa 100644 --- a/hw/opentitan/ot_ibex_wrapper_darjeeling.c +++ b/hw/opentitan/ot_ibex_wrapper_darjeeling.c @@ -1075,7 +1075,7 @@ static void ot_ibex_wrapper_dj_log_emit(OtIbexWrapperDjState *s) } /* discard the path of the stored file to reduce log message length */ - const char *basename = strrchr(eng->filename, '/'); + const char *basename = eng->filename ? strrchr(eng->filename, '/') : NULL; basename = basename ? basename + 1u : eng->filename; char *logfmt = g_strdup_printf("%s %s:%d %s\n", level, basename, diff --git a/hw/opentitan/ot_ibex_wrapper_earlgrey.c b/hw/opentitan/ot_ibex_wrapper_earlgrey.c index 013f120afa4d..d19c28788ffd 100644 --- a/hw/opentitan/ot_ibex_wrapper_earlgrey.c +++ b/hw/opentitan/ot_ibex_wrapper_earlgrey.c @@ -589,7 +589,7 @@ static void ot_ibex_wrapper_eg_log_emit(OtIbexWrapperEgState *s) } /* discard the path of the stored file to reduce log message length */ - const char *basename = strrchr(eng->filename, '/'); + const char *basename = eng->filename ? strrchr(eng->filename, '/') : NULL; basename = basename ? basename + 1u : eng->filename; char *logfmt = g_strdup_printf("%s %s:%d %s\n", level, basename,