]> Git Repo - linux.git/commitdiff
staging: r8188eu: hal: remove goto statement and local variable
authorSaurav Girepunje <[email protected]>
Wed, 27 Oct 2021 04:38:08 +0000 (10:08 +0530)
committerGreg Kroah-Hartman <[email protected]>
Sat, 30 Oct 2021 09:15:55 +0000 (11:15 +0200)
Remove the goto statement from FillH2CCmd_88E(). In this function goto
can be replace by return statement. As on goto label exit, function
only return it is not performing any cleanup. Avoiding goto will
improve the function readability. After replacing the goto statement
local variable ret is also not needed. So remove the ret local variable.

Signed-off-by: Saurav Girepunje <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/r8188eu/hal/rtl8188e_cmd.c

index 14eed14a4c6a43f0e79c2b7d461da8008177457e..e44bcde92cc39ff37d7b8f48f799061b9901ce87 100644 (file)
@@ -53,19 +53,14 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p
        u8 cmd_idx, ext_cmd_len;
        u32 h2c_cmd = 0;
        u32 h2c_cmd_ex = 0;
-       s32 ret = _FAIL;
 
        if (!adapt->bFWReady) {
                DBG_88E("FillH2CCmd_88E(): return H2C cmd because fw is not ready\n");
-               return ret;
+               return _FAIL;
        }
 
-       if (!pCmdBuffer)
-               goto exit;
-       if (CmdLen > RTL88E_MAX_CMD_LEN)
-               goto exit;
-       if (adapt->bSurpriseRemoved)
-               goto exit;
+       if (!pCmdBuffer || CmdLen > RTL88E_MAX_CMD_LEN || adapt->bSurpriseRemoved)
+               return _FAIL;
 
        /* pay attention to if  race condition happened in  H2C cmd setting. */
        do {
@@ -73,7 +68,7 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p
 
                if (!_is_fw_read_cmd_down(adapt, h2c_box_num)) {
                        DBG_88E(" fw read cmd failed...\n");
-                       goto exit;
+                       return _FAIL;
                }
 
                *(u8 *)(&h2c_cmd) = ElementID;
@@ -102,11 +97,7 @@ static s32 FillH2CCmd_88E(struct adapter *adapt, u8 ElementID, u32 CmdLen, u8 *p
 
        } while ((!bcmd_down) && (retry_cnts--));
 
-       ret = _SUCCESS;
-
-exit:
-
-       return ret;
+       return _SUCCESS;
 }
 
 u8 rtl8188e_set_raid_cmd(struct adapter *adapt, u32 mask)
This page took 0.058751 seconds and 4 git commands to generate.