Skip to contentSkip to conversation

ath10k: remove unnecessary comparison of unsigned integer with < 0

PATCH In review Gustavo A. R. Silva 2 participants 3 messages Oct 5, 2018 – Oct 13, 2018

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

PATCH 1/1 ath10k: remove unnecessary comparison of unsigned integer with < 0

There is no need to compare *ps_state_enable* with < 0 because such variable is of type u8 (8 bits, unsigned), making it impossible to hold a negative value.

Fix this by removing such comparison.

Addresses-Coverity-ID: 1473921 ("Unsigned compared against 0")

---
 drivers/net/wireless/ath/ath10k/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/debug.c +1 -1
index 2c0cb67..15964b3 100644
@@ -2421,7 +2421,7 @@ static ssize_t ath10k_write_ps_state_enable(struct file *file,
 	if (kstrtou8_from_user(user_buf, count, 0, &ps_state_enable))
 		return -EINVAL;
 
-	if (ps_state_enable > 1 || ps_state_enable < 0)
+	if (ps_state_enable > 1)
 		return -EINVAL;
 
 	mutex_lock(&ar->conf_mutex);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines · Gustavo A. R. Silva

There is no need to compare *ps_state_enable* with < 0 because such variable is of type u8 (8 bits, unsigned), making it impossible to hold a negative value.

Fix this by removing such comparison.

Addresses-Coverity-ID: 1473921 ("Unsigned compared against 0")

Patch applied to ath-next branch of ath.git, thanks.

7bfd82bff60e ath10k: remove unnecessary comparison of unsigned integer with < 0

Signature · 3 lines
https://patchwork.kernel.org/patch/10628679/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 9 lines · Gustavo A. R. Silva

There is no need to compare *ps_state_enable* with < 0 because such variable is of type u8 (8 bits, unsigned), making it impossible to hold a negative value.

Fix this by removing such comparison.

Addresses-Coverity-ID: 1473921 ("Unsigned compared against 0")

Patch applied to ath-next branch of ath.git, thanks.

7bfd82bff60e ath10k: remove unnecessary comparison of unsigned integer with < 0

Signature · 3 lines
https://patchwork.kernel.org/patch/10628679/

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