linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: rtl818x: remove redundant check for cck_power > 15
@ 2017-11-14 17:01 Colin King
  2017-12-07 13:16 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-11-14 17:01 UTC (permalink / raw)
  To: Hin-Tak Leung, Larry Finger, Kalle Valo, linux-wireless, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

cck_poweri cannot be greated than 15 as is derived from the bottom 4 bits
from riv->channels[channel - 1].hw_value & 0xf.  Hence the check for it
being greater than 15 is redundant and can be removed.

Detected by CoverityScan, CID#744303 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
index e6668ffb77e6..ff0971f1e2c8 100644
--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c
@@ -688,10 +688,7 @@ static void rtl8225z2_b_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
 	cck_power = priv->channels[channel - 1].hw_value & 0xF;
 	ofdm_power = priv->channels[channel - 1].hw_value >> 4;
 
-	if (cck_power > 15)
-		cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22;
-	else
-		cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7;
+	cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7;
 	cck_power += priv->txpwr_base & 0xF;
 	cck_power = min(cck_power, (u8)35);
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: rtlwifi: rtl818x: remove redundant check for cck_power > 15
  2017-11-14 17:01 [PATCH] rtlwifi: rtl818x: remove redundant check for cck_power > 15 Colin King
@ 2017-12-07 13:16 ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-12-07 13:16 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Hin-Tak Leung, Larry Finger, linux-wireless, netdev,
	kernel-janitors, linux-kernel

Colin Ian King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> cck_poweri cannot be greated than 15 as is derived from the bottom 4 bits
> from riv->channels[channel - 1].hw_value & 0xf.  Hence the check for it
> being greater than 15 is redundant and can be removed.
> 
> Detected by CoverityScan, CID#744303 ("Logically dead code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied to wireless-drivers-next.git, thanks.

45d9d1a12efa rtlwifi: rtl818x: remove redundant check for cck_power > 15

-- 
https://patchwork.kernel.org/patch/10057925/

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtlwifi: rtl818x: remove redundant check for cck_power > 15
       [not found] <734417985.2789125.1512428275673.ref@mail.yahoo.com>
@ 2017-12-04 22:57 ` Hin-Tak Leung
  0 siblings, 0 replies; 3+ messages in thread
From: Hin-Tak Leung @ 2017-12-04 22:57 UTC (permalink / raw)
  To: Larry Finger, Kalle Valo, linux-wireless, netdev, Colin King
  Cc: kernel-janitors, linux-kernel


--------------------------------------------
On Tue, 14/11/17, Colin King <colin.king@canonical.com> wrote:

=20
> From: Colin Ian King <colin.king@canonical.com>
=20
> cck_poweri cannot be greated than 15 as
> is derived from the bottom 4 bits
> from riv->channels[channel -
> 1].hw_value & 0xf.=C2=A0 Hence the check for it
> being greater than 15 is redundant and
> can be removed.
=20
> Detected by CoverityScan, CID#744303
> ("Logically dead code")
=20
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
=20
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-07 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 17:01 [PATCH] rtlwifi: rtl818x: remove redundant check for cck_power > 15 Colin King
2017-12-07 13:16 ` Kalle Valo
     [not found] <734417985.2789125.1512428275673.ref@mail.yahoo.com>
2017-12-04 22:57 ` [PATCH] " Hin-Tak Leung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).