staging: r8188eu: replace switch-case with if
authorMartin Kaiser <martin@kaiser.cx>
Sun, 30 Oct 2022 17:33:20 +0000 (18:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 31 Oct 2022 08:09:04 +0000 (09:09 +0100)
OnAction_p2p has a switch-case statement where only a single case is
handled. Use if instead, this makes the code shorter and easier to read.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221030173326.1588647-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_mlme_ext.c

index efcb2f3..64d01da 100644 (file)
@@ -3852,19 +3852,8 @@ static void OnAction_p2p(struct adapter *padapter, struct recv_frame *precv_fram
        len -= sizeof(struct ieee80211_hdr_3addr);
        OUI_Subtype = frame_body[5];
 
-       switch (OUI_Subtype) {
-       case P2P_NOTICE_OF_ABSENCE:
-               break;
-       case P2P_PRESENCE_REQUEST:
+       if (OUI_Subtype == P2P_PRESENCE_REQUEST)
                process_p2p_presence_req(pwdinfo, pframe, len);
-               break;
-       case P2P_PRESENCE_RESPONSE:
-               break;
-       case P2P_GO_DISC_REQUEST:
-               break;
-       default:
-               break;
-       }
 }
 
 static void OnAction(struct adapter *padapter, struct recv_frame *precv_frame)