Skip to contentSkip to conversation

wifi: rt2x00: remove redundant check if u8 array element is less than zero

PATCH In review Colin Ian King 2 participants 2 messages Sep 20, 2023 – Sep 28, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: rt2x00: remove redundant check if u8 array element is less than zero

The check on vga_gain[ch_idx] being less than zero is always false since vga_gain is a u8 array. Clean up the code by removing the check and the following assignment. Cleans up clang scan build warning:

drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9704:26: warning:
result of comparison of unsigned expression < 0 is always false [-Wtautological-unsigned-zero-compare]

---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +0 -3
index e65cc00fa17c..fe11fa4917ac 100644
@@ -9700,9 +9700,6 @@ static void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev)
 
 				rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n", vga_gain[ch_idx],
 					   rfvga_gain_table[vga_gain[ch_idx]]);
-
-				if (vga_gain[ch_idx] < 0)
-					vga_gain[ch_idx] = 0;
 			}
 
 			rfvalue = rfvga_gain_table[vga_gain[ch_idx]];
Signature · 1 line
2.39.2
#1 lore raw
Quoted 9 lines · Colin Ian King

The check on vga_gain[ch_idx] being less than zero is always false since vga_gain is a u8 array. Clean up the code by removing the check and the following assignment. Cleans up clang scan build warning:

drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9704:26: warning:
result of comparison of unsigned expression < 0 is always false [-Wtautological-unsigned-zero-compare]

Patch applied to wireless-next.git, thanks.

b2172a9330b5 wifi: rt2x00: remove redundant check if u8 array element is less than zero

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches