Skip to contentSkip to conversation

staging: rtl8821ae: fix invalid bit mask on MSR_AP check

RFC PATCH In review Levente Kurusa 2 participants 5 messages Feb 14, 2014 – Feb 15, 2014 Staging

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 staging: rtl8821ae: fix invalid bit mask on MSR_AP check

Since MSR_AP is 0x3, ANDing it with 0xFC will never be true. Add a NOT operation to 0xFC so that we will AND with the last three bits which will result in a possibility that the condition will succeed.

---
Hi,

This might not be the real solution since it is also possible that the particular condition never really happens. I seek comments so that I can post the proper patch.

Thanks!

 drivers/staging/rtl8821ae/rtl8821ae/hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8821ae/rtl8821ae/hw.c +1 -1
index 5ed7a11..f204b31 100644
@@ -1622,7 +1622,7 @@ static int _rtl8821ae_set_media_status(struct ieee80211_hw *hw,
 
 	rtl_write_byte(rtlpriv, (MSR), bt_msr);
 	rtlpriv->cfg->ops->led_control(hw, ledaction);
-	if ((bt_msr & 0xfc) == MSR_AP)
+	if ((bt_msr & ~0xfc) == MSR_AP)
 		rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00);
 	else
 		rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Levente Kurusa

Since MSR_AP is 0x3, ANDing it with 0xFC will never be true. Add a NOT operation to 0xFC so that we will AND with the last three bits which will result in a possibility that the condition will succeed.

Quoted 8 lines

---
Hi,

This might not be the real solution since it is also possible that the particular condition never really happens. I seek comments so that I can post the proper patch.

I can't test it either but I think your fix is correct.

regards,
dan carpenter

#2 lore raw
Quoted 8 lines · Dan Carpenter

[...]

Quoted 6 lines

Hi,

This might not be the real solution since it is also possible that the particular condition never really happens. I seek comments so that I can post the proper patch.

Quoted 4 lines

I can't test it either but I think your fix is correct.

Thanks Dan, maybe you know some people who could test it? RTLXXXXXX guys? Or maybe we can take the patch as is? I cannot really think of any other solution other than removing the other clause, but since that was written to the file, there must have been some logic behind that. I am slightly disappointed get_maintainer didn't really find anybody for this patch...

Greg, can you take it as is or you would need the RFC tag removed? (ie, repost)
Maybe you know somebody who could test it as well?

Signature · 2 lines
Regards,
Levente Kurusa
#3 lore raw
Quoted 7 lines · Levente Kurusa

Thanks Dan, maybe you know some people who could test it? RTLXXXXXX guys? Or maybe we can take the patch as is? I cannot really think of any other solution other than removing the other clause, but since that was written to the file, there must have been some logic behind that. I am slightly disappointed get_maintainer didn't really find anybody for this patch...

This driver is going to be deleted in the next couple weeks and replaced with a re-written from scratch driver.

Your fix is correct. It's just that no one tested the AP code for this. I would feel comfortable applying it as-is if no one is available to test it.

regards,
dan carpenter

#4 lore raw
Quoted 9 lines · Dan Carpenter
Quoted 7 lines · Levente Kurusa

Thanks Dan, maybe you know some people who could test it? RTLXXXXXX guys? Or maybe we can take the patch as is? I cannot really think of any other solution other than removing the other clause, but since that was written to the file, there must have been some logic behind that. I am slightly disappointed get_maintainer didn't really find anybody for this patch...

Quoted 3 lines

This driver is going to be deleted in the next couple weeks and replaced with a re-written from scratch driver.

Oh, I did not know that. Since this fix isn't that big, I think it won't get into the next -rc, and hence might not hit Linus' tree before the new driver gets into staging. I am not sure if it is worth applying if that is the case.

Signature · 2 lines
Regards,
Levente Kurusa