Skip to content

Commit 18b89d1

Browse files
mistraubegregkh
authored andcommitted
staging: rtl8192e: convert else if sequence to switch
Convert a sequence of else if statements that all check the same variable to a single switch statement. With a switch statement it is easier to see what is going on. Additionally this clears a checkpatch warning. WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Michael Straube <straube.linux@gmail.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20230619150953.22484-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5642424 commit 18b89d1

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

drivers/staging/rtl8192e/rtllib_softmac.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,15 +2830,19 @@ void rtllib_start_protocol(struct rtllib_device *ieee)
28302830
* attempts does not fail just because the user provide the essid
28312831
* and the nic is still checking for the AP MAC ??
28322832
*/
2833-
if (ieee->iw_mode == IW_MODE_INFRA) {
2833+
switch (ieee->iw_mode) {
2834+
case IW_MODE_INFRA:
28342835
rtllib_start_bss(ieee);
2835-
} else if (ieee->iw_mode == IW_MODE_ADHOC) {
2836+
break;
2837+
case IW_MODE_ADHOC:
28362838
rtllib_start_ibss(ieee);
2837-
2838-
} else if (ieee->iw_mode == IW_MODE_MASTER) {
2839+
break;
2840+
case IW_MODE_MASTER:
28392841
rtllib_start_master_bss(ieee);
2840-
} else if (ieee->iw_mode == IW_MODE_MONITOR) {
2842+
break;
2843+
case IW_MODE_MONITOR:
28412844
rtllib_start_monitor_mode(ieee);
2845+
break;
28422846
}
28432847
}
28442848

0 commit comments

Comments
 (0)