Skip to contentSkip to conversation

lib: 842 - Remove useless checking in add_template()

PATCH New Yunfeng Ye 1 participant 2 messages May 16, 2020 IBM Power 842 compression accelerator

lore
Share & tools
lore

Yunfeng Ye

author
#0 lore raw

PATCH 1/2 lib: 842 - Remove useless checking in add_template()

A warning was found by smatch tool:
"add_template() error: testing array offset 'c' after use."

Fix it by removing the useless checking in add_template().

---
 lib/842/842_compress.c | 3 ---
 1 file changed, 3 deletions(-)
lib/842/842_compress.c +0 -3
index c02baa4168e1..18255d25781b 100644
@@ -225,9 +225,6 @@ static int add_template(struct sw842_param *p, u8 c)
 	u8 *t = comp_ops[c];
 	bool inv = false;
 
-	if (c >= OPS_MAX)
-		return -EINVAL;
-
 	pr_debug("template %x\n", t[4]);
 
 	ret = add_bits(p, t[4], OP_BITS);
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 2/2 lib: 842 - Remove useless checking in check_template()

A warning was found by smatch tool:
"check_template() error: testing array offset 'c' after use."

Fix it by removing the useless checking in check_template().

---
 lib/842/842_compress.c | 3 ---
 1 file changed, 3 deletions(-)
lib/842/842_compress.c +0 -3
index 18255d25781b..8d25345b4b49 100644
@@ -379,9 +379,6 @@ static bool check_template(struct sw842_param *p, u8 c)
 	u8 *t = comp_ops[c];
 	int i, match, b = 0;
 
-	if (c >= OPS_MAX)
-		return false;
-
 	for (i = 0; i < 4; i++) {
 		if (t[i] & OP_ACTION_INDEX) {
 			if (t[i] & OP_AMOUNT_2)
Signature · 1 line
1.8.3.1