* [PATCH] staging: rtl8192u: fix incorrect mask for EEPROMTxPowerLevelCCK setting
@ 2019-03-29 0:02 Colin King
2019-03-29 8:24 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2019-03-29 0:02 UTC (permalink / raw)
To: Greg Kroah-Hartman, John Whitmore, devel; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the lower 8 bits of ret are being masked and left
shifted by 8 bits always leaving a result of zero. The mask
appears to be incorrect and should probably be 0xff00 instead
of 0xff. Fix this. (Note: not tested).
Fixes: 16feab644fd1 ("staging: rtl8192u: check return value eprom_read")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/rtl8192u/r8192U_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index f1eaab337dca..a173884d31c8 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2454,7 +2454,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
ret = eprom_read(dev, (EEPROM_TX_PW_INDEX_CCK >> 1));
if (ret < 0)
return ret;
- priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8;
+ priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8;
} else
priv->EEPROMTxPowerLevelCCK = 0x10;
RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8192u: fix incorrect mask for EEPROMTxPowerLevelCCK setting
2019-03-29 0:02 [PATCH] staging: rtl8192u: fix incorrect mask for EEPROMTxPowerLevelCCK setting Colin King
@ 2019-03-29 8:24 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-03-29 8:24 UTC (permalink / raw)
To: Colin King
Cc: Greg Kroah-Hartman, John Whitmore, devel, kernel-janitors, linux-kernel
On Fri, Mar 29, 2019 at 12:02:44AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the lower 8 bits of ret are being masked and left
> shifted by 8 bits always leaving a result of zero. The mask
> appears to be incorrect and should probably be 0xff00 instead
> of 0xff. Fix this. (Note: not tested).
>
> Fixes: 16feab644fd1 ("staging: rtl8192u: check return value eprom_read")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/staging/rtl8192u/r8192U_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index f1eaab337dca..a173884d31c8 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -2454,7 +2454,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
> ret = eprom_read(dev, (EEPROM_TX_PW_INDEX_CCK >> 1));
> if (ret < 0)
> return ret;
> - priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8;
> + priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8;
I'd say there is a 80-90% chance your fix is correct...
This only affects an older rev of the eeprom I think. I believe what
happens in the current code is that we set EEPROMTxPowerLevelCCK to
zero. Then we subtract:
priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelOFDM24G[0] + (priv->EEPROMTxPowerLevelCCK - priv->EEPROMTxPowerLevelOFDM24G[1]);
Possibly leading to a high u8 value, then in phy_set_rf8256_cck_tx_power()
it gets capped at 0x24...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8192u: fix incorrect mask for EEPROMTxPowerLevelCCK setting
@ 2019-03-29 8:24 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-03-29 8:24 UTC (permalink / raw)
To: Colin King
Cc: Greg Kroah-Hartman, John Whitmore, devel, kernel-janitors, linux-kernel
On Fri, Mar 29, 2019 at 12:02:44AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the lower 8 bits of ret are being masked and left
> shifted by 8 bits always leaving a result of zero. The mask
> appears to be incorrect and should probably be 0xff00 instead
> of 0xff. Fix this. (Note: not tested).
>
> Fixes: 16feab644fd1 ("staging: rtl8192u: check return value eprom_read")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/staging/rtl8192u/r8192U_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index f1eaab337dca..a173884d31c8 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -2454,7 +2454,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
> ret = eprom_read(dev, (EEPROM_TX_PW_INDEX_CCK >> 1));
> if (ret < 0)
> return ret;
> - priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff) >> 8;
> + priv->EEPROMTxPowerLevelCCK = ((u16)ret & 0xff00) >> 8;
I'd say there is a 80-90% chance your fix is correct...
This only affects an older rev of the eeprom I think. I believe what
happens in the current code is that we set EEPROMTxPowerLevelCCK to
zero. Then we subtract:
priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelOFDM24G[0] + (priv->EEPROMTxPowerLevelCCK - priv->EEPROMTxPowerLevelOFDM24G[1]);
Possibly leading to a high u8 value, then in phy_set_rf8256_cck_tx_power()
it gets capped at 0x24...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-29 8:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 0:02 [PATCH] staging: rtl8192u: fix incorrect mask for EEPROMTxPowerLevelCCK setting Colin King
2019-03-29 8:24 ` Dan Carpenter
2019-03-29 8:24 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.