staging: rtl8192e: convert else if sequence to switch
authorMichael Straube <straube.linux@gmail.com>
Mon, 19 Jun 2023 15:09:51 +0000 (17:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jun 2023 14:14:32 +0000 (16:14 +0200)
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>
drivers/staging/rtl8192e/rtllib_softmac.c

index 863e559..425d4ac 100644 (file)
@@ -2830,15 +2830,19 @@ void rtllib_start_protocol(struct rtllib_device *ieee)
         * attempts does not fail just because the user provide the essid
         * and the nic is still checking for the AP MAC ??
         */
-       if (ieee->iw_mode == IW_MODE_INFRA) {
+       switch (ieee->iw_mode) {
+       case IW_MODE_INFRA:
                rtllib_start_bss(ieee);
-       } else if (ieee->iw_mode == IW_MODE_ADHOC) {
+               break;
+       case IW_MODE_ADHOC:
                rtllib_start_ibss(ieee);
-
-       } else if (ieee->iw_mode == IW_MODE_MASTER) {
+               break;
+       case IW_MODE_MASTER:
                rtllib_start_master_bss(ieee);
-       } else if (ieee->iw_mode == IW_MODE_MONITOR) {
+               break;
+       case IW_MODE_MONITOR:
                rtllib_start_monitor_mode(ieee);
+               break;
        }
 }