[PATCH] dmi: dmi_decode: remove redundant snprintf
Colin King
colin.king at canonical.com
Tue May 7 00:03:55 UTC 2013
From: Colin Ian King <colin.king at canonical.com>
Coverity CID #997280, Nesting level does not match indentation
Fix two bugs; the first is that the snprintf is redundant, the
second is that the following fwts_failed was should only be
printed on the if ((val < 0x1) || (val > 0xd)). Add explicit
{ } brackets just to clarify the intent.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/dmi/dmi_decode/dmi_decode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c
index 0e775db..d89ab28 100644
--- a/src/dmi/dmi_decode/dmi_decode.c
+++ b/src/dmi/dmi_decode/dmi_decode.c
@@ -597,8 +597,7 @@ static void dmi_decode_entry(fwts_framework *fw,
"offset 0x%2.2x",
val, table, addr, i, 0x15 + (i*len));
} else {
- if ((val < 0x1) || (val > 0xd))
- snprintf(tmp, sizeof(tmp), "Base Board Type %d", i);
+ if ((val < 0x1) || (val > 0xd)) {
fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE,
"Out of range value 0x%2.2" PRIx8
" (range allowed 0x00..0x42) "
@@ -606,6 +605,7 @@ static void dmi_decode_entry(fwts_framework *fw,
"0x%8.8" PRIx32 ", field "
"'Base Board Type %d', offset 0x%2.2x",
val, table, addr, i, 0x15 + (i*len));
+ }
}
}
}
--
1.8.1.2
More information about the fwts-devel
mailing list