gpu: nvgpu: unit: Fix --no-color bug

The color itself was not being printed when `--no-color' was set
but the reset color escape sequence was still being printed. This
fixes that bug so that now, when `--no-color' is specified neither
the color or the reset sequence is printed.

This cleans up the log mess in GVS runs.

JIRA  NVGPU-1737

Change-Id: I8f612d3f920b78e25ba606add703b310da36d7a7
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2007626
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2019-01-30 09:20:44 -08:00
committed by mobile promotions
parent 505ee572bc
commit 16735840ee

View File

@@ -35,12 +35,16 @@ static void __core_print_file(struct unit_fw *fw, FILE *filp,
const char *prefix, const char *msg,
const char *color)
{
if (color == NULL || args(fw)->no_color)
const char *reset = C_RESET;
if (color == NULL || args(fw)->no_color) {
color = "";
reset = "";
}
fprintf(filp, "[%s%s%s] %s%s%s",
color, prefix, C_RESET,
color, msg, C_RESET);
color, prefix, reset,
color, msg, reset);
}
__attribute__((format (printf, 3, 4)))