diff mbox series

rtlwifi: rtl8821ae: add in a missing break in switch statement

Message ID 20181006184246.29985-1-colin.king@canonical.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series rtlwifi: rtl8821ae: add in a missing break in switch statement | expand

Commit Message

Colin King Oct. 6, 2018, 6:42 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
to be unintentional as the setting of variable ret gets overwritten
when the case falls through to the following RATR_INX_WIRELESS_AC_5N
case.  Fix this by adding in the missing break.

Detected by CoverityScan, CID#1167237 ("Missing break in switch")

Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kalle Valo Oct. 6, 2018, 7:30 p.m. UTC | #1
Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
> to be unintentional as the setting of variable ret gets overwritten
> when the case falls through to the following RATR_INX_WIRELESS_AC_5N
> case.  Fix this by adding in the missing break.
>
> Detected by CoverityScan, CID#1167237 ("Missing break in switch")
>
> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +

Is the fixes line correct? This patch is not for staging.
Larry Finger Oct. 6, 2018, 8:05 p.m. UTC | #2
On 10/6/18 2:30 PM, Kalle Valo wrote:
> Colin King <colin.king@canonical.com> writes:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
>> to be unintentional as the setting of variable ret gets overwritten
>> when the case falls through to the following RATR_INX_WIRELESS_AC_5N
>> case.  Fix this by adding in the missing break.
>>
>> Detected by CoverityScan, CID#1167237 ("Missing break in switch")
>>
>> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
> 
> Is the fixes line correct? This patch is not for staging.

No, the correct fixes commit is 21e4b0726dc67 (" rtlwifi: rtl8821ae: Move driver 
from staging to regular tree").

This driver was initially placed in staging as it was needed for a special 
project, which is the commit that Colin used. As the patch subject states, the 
driver was later moved to the regular wireless tree.

That break is required, thus ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>

thanks,

Larry
Joe Perches Oct. 6, 2018, 8:17 p.m. UTC | #3
On Sat, 2018-10-06 at 15:05 -0500, Larry Finger wrote:
> On 10/6/18 2:30 PM, Kalle Valo wrote:
> > Colin King <colin.king@canonical.com> writes:
> > 
> > > From: Colin Ian King <colin.king@canonical.com>
> > > 
> > > The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
> > > to be unintentional as the setting of variable ret gets overwritten
> > > when the case falls through to the following RATR_INX_WIRELESS_AC_5N
> > > case.  Fix this by adding in the missing break.
> > > 
> > > Detected by CoverityScan, CID#1167237 ("Missing break in switch")
> > > 
> > > Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > ---
> > >   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
> > 
> > Is the fixes line correct? This patch is not for staging.
> 
> No, the correct fixes commit is 21e4b0726dc67 (" rtlwifi: rtl8821ae: Move driver  
> from staging to regular tree").
> 
> This driver was initially placed in staging as it was needed for a special 
> project, which is the commit that Colin used. As the patch subject states, the 
> driver was later moved to the regular wireless tree.
> 
> That break is required, thus ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>

Why not remove this entirely and use the generic routine in
drivers/net/wireless/realtek/rtlwifi/base.c?

Is there a real difference?
Larry Finger Oct. 6, 2018, 10 p.m. UTC | #4
On 10/6/18 3:17 PM, Joe Perches wrote:
> On Sat, 2018-10-06 at 15:05 -0500, Larry Finger wrote:
>> On 10/6/18 2:30 PM, Kalle Valo wrote:
>>> Colin King <colin.king@canonical.com> writes:
>>>
>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
>>>> to be unintentional as the setting of variable ret gets overwritten
>>>> when the case falls through to the following RATR_INX_WIRELESS_AC_5N
>>>> case.  Fix this by adding in the missing break.
>>>>
>>>> Detected by CoverityScan, CID#1167237 ("Missing break in switch")
>>>>
>>>> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>> ---
>>>>    drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
>>>
>>> Is the fixes line correct? This patch is not for staging.
>>
>> No, the correct fixes commit is 21e4b0726dc67 (" rtlwifi: rtl8821ae: Move driver
>> from staging to regular tree").
>>
>> This driver was initially placed in staging as it was needed for a special
>> project, which is the commit that Colin used. As the patch subject states, the
>> driver was later moved to the regular wireless tree.
>>
>> That break is required, thus ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
> 
> Why not remove this entirely and use the generic routine in
> drivers/net/wireless/realtek/rtlwifi/base.c?
> 
> Is there a real difference?

I did not see any difference other than the removal of a bunch of magic numbers 
and better formatting.

Larry
Joe Perches Oct. 6, 2018, 10:03 p.m. UTC | #5
On Sat, 2018-10-06 at 17:00 -0500, Larry Finger wrote:
> On 10/6/18 3:17 PM, Joe Perches wrote:
> > On Sat, 2018-10-06 at 15:05 -0500, Larry Finger wrote:
> > > On 10/6/18 2:30 PM, Kalle Valo wrote:
> > > > Colin King <colin.king@canonical.com> writes:
> > > > 
> > > > > From: Colin Ian King <colin.king@canonical.com>
> > > > > 
> > > > > The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
> > > > > to be unintentional as the setting of variable ret gets overwritten
> > > > > when the case falls through to the following RATR_INX_WIRELESS_AC_5N
> > > > > case.  Fix this by adding in the missing break.
> > > > > 
> > > > > Detected by CoverityScan, CID#1167237 ("Missing break in switch")
> > > > > 
> > > > > Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> > > > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > > > ---
> > > > >    drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
> > > > 
> > > > Is the fixes line correct? This patch is not for staging.
> > > 
> > > No, the correct fixes commit is 21e4b0726dc67 (" rtlwifi: rtl8821ae: Move driver
> > > from staging to regular tree").
> > > 
> > > This driver was initially placed in staging as it was needed for a special
> > > project, which is the commit that Colin used. As the patch subject states, the
> > > driver was later moved to the regular wireless tree.
> > > 
> > > That break is required, thus ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
> > 
> > Why not remove this entirely and use the generic routine in
> > drivers/net/wireless/realtek/rtlwifi/base.c?
> > 
> > Is there a real difference?
> 
> I did not see any difference other than the removal of a bunch of magic numbers 
> and better formatting.

Me neither.
Larry Finger Oct. 7, 2018, 12:48 a.m. UTC | #6
On 10/6/18 5:03 PM, Joe Perches wrote:
> On Sat, 2018-10-06 at 17:00 -0500, Larry Finger wrote:
>> On 10/6/18 3:17 PM, Joe Perches wrote:
>>> On Sat, 2018-10-06 at 15:05 -0500, Larry Finger wrote:
>>>> On 10/6/18 2:30 PM, Kalle Valo wrote:
>>>>> Colin King <colin.king@canonical.com> writes:
>>>>>
>>>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>>>
>>>>>> The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
>>>>>> to be unintentional as the setting of variable ret gets overwritten
>>>>>> when the case falls through to the following RATR_INX_WIRELESS_AC_5N
>>>>>> case.  Fix this by adding in the missing break.
>>>>>>
>>>>>> Detected by CoverityScan, CID#1167237 ("Missing break in switch")
>>>>>>
>>>>>> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
>>>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>>>> ---
>>>>>>     drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
>>>>>
>>>>> Is the fixes line correct? This patch is not for staging.
>>>>
>>>> No, the correct fixes commit is 21e4b0726dc67 (" rtlwifi: rtl8821ae: Move driver
>>>> from staging to regular tree").
>>>>
>>>> This driver was initially placed in staging as it was needed for a special
>>>> project, which is the commit that Colin used. As the patch subject states, the
>>>> driver was later moved to the regular wireless tree.
>>>>
>>>> That break is required, thus ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
>>>
>>> Why not remove this entirely and use the generic routine in
>>> drivers/net/wireless/realtek/rtlwifi/base.c?
>>>
>>> Is there a real difference?
>>
>> I did not see any difference other than the removal of a bunch of magic numbers
>> and better formatting.
> 
> Me neither.

Colin,

Do you want to push the new patch removing the duplicate routine from rtl8821ae?

Larry
Colin King Oct. 8, 2018, 8:55 a.m. UTC | #7
On 07/10/18 01:48, Larry Finger wrote:
> On 10/6/18 5:03 PM, Joe Perches wrote:
>> On Sat, 2018-10-06 at 17:00 -0500, Larry Finger wrote:
>>> On 10/6/18 3:17 PM, Joe Perches wrote:
>>>> On Sat, 2018-10-06 at 15:05 -0500, Larry Finger wrote:
>>>>> On 10/6/18 2:30 PM, Kalle Valo wrote:
>>>>>> Colin King <colin.king@canonical.com> writes:
>>>>>>
>>>>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>>>>
>>>>>>> The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
>>>>>>> to be unintentional as the setting of variable ret gets overwritten
>>>>>>> when the case falls through to the following RATR_INX_WIRELESS_AC_5N
>>>>>>> case.  Fix this by adding in the missing break.
>>>>>>>
>>>>>>> Detected by CoverityScan, CID#1167237 ("Missing break in switch")
>>>>>>>
>>>>>>> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI
>>>>>>> WIFI driver")
>>>>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>>>>> ---
>>>>>>>     drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 1 +
>>>>>>
>>>>>> Is the fixes line correct? This patch is not for staging.
>>>>>
>>>>> No, the correct fixes commit is 21e4b0726dc67 (" rtlwifi:
>>>>> rtl8821ae: Move driver
>>>>> from staging to regular tree").
>>>>>
>>>>> This driver was initially placed in staging as it was needed for a
>>>>> special
>>>>> project, which is the commit that Colin used. As the patch subject
>>>>> states, the
>>>>> driver was later moved to the regular wireless tree.
>>>>>
>>>>> That break is required, thus ACKed-by: Larry Finger
>>>>> <Larry.Finger@lwfinger.net>
>>>>
>>>> Why not remove this entirely and use the generic routine in
>>>> drivers/net/wireless/realtek/rtlwifi/base.c?
>>>>
>>>> Is there a real difference?
>>>
>>> I did not see any difference other than the removal of a bunch of
>>> magic numbers
>>> and better formatting.
>>
>> Me neither.
> 
> Colin,
> 
> Do you want to push the new patch removing the duplicate routine from
> rtl8821ae?

Indeed. Sent.
> 
> Larry
Kalle Valo Oct. 13, 2018, 11:59 a.m. UTC | #8
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> The switch case RATR_INX_WIRELESS_MC has a missing break, this seems
> to be unintentional as the setting of variable ret gets overwritten
> when the case falls through to the following RATR_INX_WIRELESS_AC_5N
> case.  Fix this by adding in the missing break.
> 
> Detected by CoverityScan, CID#1167237 ("Missing break in switch")
> 
> Fixes: 3c05bedb5fef ("Staging: rtl8812ae: Add Realtek 8821 PCI WIFI driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Dropping this patch per discussion.

Patch set to Changes Requested.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
index 317c1b3101da..8af49c1c99db 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c
@@ -3448,6 +3448,7 @@  static u8 _rtl8821ae_mrate_idx_to_arfr_id(
 			ret = 6;
 		else
 			ret = 7;
+		break;
 	case RATR_INX_WIRELESS_AC_5N:
 		if (rtlphy->rf_type == RF_1T1R)
 			ret = 10;