[PATCH] dmi: dmi_decode: remove some redundant range changes on uint8_t values
Colin King
colin.king at canonical.com
Thu Oct 25 13:00:07 UTC 2012
From: Colin Ian King <colin.king at canonical.com>
-Wextra shows that we are doing some redundant range checks on uint8_t
values, so just remove them to clean up the code.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/dmi/dmi_decode/dmi_decode.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c
index aa1ce15..183be3c 100644
--- a/src/dmi/dmi_decode/dmi_decode.c
+++ b/src/dmi/dmi_decode/dmi_decode.c
@@ -773,8 +773,7 @@ static void dmi_decode_entry(fwts_framework *fw,
if (hdr->length < 0x14)
break;
val = hdr->data[0x0a];
- if (!(((val >= 0x00) && (val <= 0x04)) ||
- ((val >= 0x80) && (val <= 0xff)))) {
+ if (!((val <= 0x04) || (val >= 0x80))) {
fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE,
"Out of range value 0x%2.2" PRIx8 " "
"(range allowed 0x00..0x01, "
@@ -785,8 +784,7 @@ static void dmi_decode_entry(fwts_framework *fw,
if (hdr->length < 0x17)
break;
val = hdr->data[0x14];
- if (!(((val >= 0x00) && (val <= 0x01)) ||
- ((val >= 0x80) && (val <= 0xff)))) {
+ if (!((val <= 0x01) || (val >= 0x80))) {
fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE,
"Out of range value 0x%2.2" PRIx8 " "
"(range allowed 0x00..0x01, "
@@ -804,7 +802,7 @@ static void dmi_decode_entry(fwts_framework *fw,
val = ptr[j];
if (!(((val >= 0x01) && (val <= 0x0e)) ||
((val >= 0x10) && (val <= 0x17)) ||
- ((val >= 0x80) && (val <= 0xff)))) {
+ (val >= 0x80))) {
fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE,
"Out of range value 0x%2.2" PRIx8 " "
"(range allowed 0x01..0x0e, 0x10..0x17, "
--
1.7.10.4
More information about the fwts-devel
mailing list