staging: vt6655: Remove useless else
authorMarcos Antonio de Jesus Filho <mdejesusfilho@gmail.com>
Mon, 9 Nov 2020 02:56:41 +0000 (18:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Nov 2020 15:35:21 +0000 (16:35 +0100)
The else statements are not useful due to the presence of a return
statement on the if block. Remove the else statements, adjust the
indentation of the code, move variable declarations to the beginning of
their scope and remove useless return statement. Reported by checkpatch.

Signed-off-by: Marcos Antonio de Jesus Filho <mdejesusfilho@gmail.com>
Link: https://lore.kernel.org/r/20201109025641.GA69196@Zangetsu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6655/rxtx.c

index 477d19314634346bc449d3aeb9e19ef2fa383f64..508e1bd7d76e79edb9de759b71467aa979d518d5 100644 (file)
@@ -440,10 +440,15 @@ s_uFillDataHead(
        bool is_pspoll
 )
 {
+       struct vnt_tx_datahead_ab *buf = pTxDataHead;
+
        if (!pTxDataHead)
                return 0;
 
        if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+               /* Auto Fallback */
+               struct vnt_tx_datahead_g_fb *buf = pTxDataHead;
+
                if (byFBOption == AUTO_FB_NONE) {
                        struct vnt_tx_datahead_g *buf = pTxDataHead;
                        /* Get SignalField, ServiceField & Length */
@@ -477,32 +482,33 @@ s_uFillDataHead(
                        buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
 
                        return buf->duration_a;
-               } else {
-                       /* Auto Fallback */
-                       struct vnt_tx_datahead_g_fb *buf = pTxDataHead;
-                       /* Get SignalField, ServiceField & Length */
-                       vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
-                                         byPktType, &buf->a);
-
-                       vnt_get_phy_field(pDevice, cbFrameLength,
-                                         pDevice->byTopCCKBasicRate,
-                                         PK_TYPE_11B, &buf->b);
-                       /* Get Duration and TimeStamp */
-                       buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
-                                                                             wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
-                       buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
-                                                                              pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
-                       buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
-                                                                                 wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
-                       buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
-                                                                                wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+               }
 
-                       buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
-                       buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
+               /* Get SignalField, ServiceField & Length */
+               vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+                                 byPktType, &buf->a);
 
-                       return buf->duration_a;
-               } /* if (byFBOption == AUTO_FB_NONE) */
+               vnt_get_phy_field(pDevice, cbFrameLength,
+                                 pDevice->byTopCCKBasicRate,
+                                 PK_TYPE_11B, &buf->b);
+               /* Get Duration and TimeStamp */
+               buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+                                                                     wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+               buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
+                                                                      pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+               buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
+                                                                         wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+               buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
+                                                                        wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+
+               buf->time_stamp_off_a = vnt_time_stamp_off(pDevice, wCurrentRate);
+               buf->time_stamp_off_b = vnt_time_stamp_off(pDevice, pDevice->byTopCCKBasicRate);
+
+               return buf->duration_a;
+                 /* if (byFBOption == AUTO_FB_NONE) */
        } else if (byPktType == PK_TYPE_11A) {
+               struct vnt_tx_datahead_ab *buf = pTxDataHead;
+
                if (byFBOption != AUTO_FB_NONE) {
                        /* Auto Fallback */
                        struct vnt_tx_datahead_a_fb *buf = pTxDataHead;
@@ -519,30 +525,8 @@ s_uFillDataHead(
                                                                                wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
                        buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
                        return buf->duration;
-               } else {
-                       struct vnt_tx_datahead_ab *buf = pTxDataHead;
-                       /* Get SignalField, ServiceField & Length */
-                       vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
-                                         byPktType, &buf->ab);
-
-                       if (is_pspoll) {
-                               __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15));
-
-                               buf->duration = dur;
-                       } else {
-                               /* Get Duration and TimeStampOff */
-                               buf->duration =
-                                       cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
-                                                                           wCurrentRate, bNeedAck, uFragIdx,
-                                                                           cbLastFragmentSize, uMACfragNum,
-                                                                           byFBOption));
-                       }
-
-                       buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
-                       return buf->duration;
                }
-       } else {
-               struct vnt_tx_datahead_ab *buf = pTxDataHead;
+
                /* Get SignalField, ServiceField & Length */
                vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
                                  byPktType, &buf->ab);
@@ -554,7 +538,7 @@ s_uFillDataHead(
                } else {
                        /* Get Duration and TimeStampOff */
                        buf->duration =
-                               cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
+                               cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
                                                                    wCurrentRate, bNeedAck, uFragIdx,
                                                                    cbLastFragmentSize, uMACfragNum,
                                                                    byFBOption));
@@ -563,7 +547,26 @@ s_uFillDataHead(
                buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
                return buf->duration;
        }
-       return 0;
+
+       /* Get SignalField, ServiceField & Length */
+       vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate,
+                         byPktType, &buf->ab);
+
+       if (is_pspoll) {
+               __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15));
+
+               buf->duration = dur;
+       } else {
+               /* Get Duration and TimeStampOff */
+               buf->duration =
+                       cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
+                                                           wCurrentRate, bNeedAck, uFragIdx,
+                                                           cbLastFragmentSize, uMACfragNum,
+                                                           byFBOption));
+       }
+
+       buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
+       return buf->duration;
 }
 
 static