staging: r8188eu: use swap()
authorChangcheng Deng <deng.changcheng@zte.com.cn>
Fri, 17 Sep 2021 10:02:38 +0000 (10:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Sep 2021 14:32:27 +0000 (16:32 +0200)
Use swap() in order to make code cleaner. Issue found by coccinelle.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
Link: https://lore.kernel.org/r/20210917100238.232576-1-deng.changcheng@zte.com.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_wlan_util.c

index 26106dd..3d1d8c1 100644 (file)
@@ -584,7 +584,7 @@ void WMMOnAssocRsp(struct adapter *padapter)
        inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3;
 
        if (pregpriv->wifi_spec == 1) {
-               u32     j, tmp, change_inx = false;
+               u32 j, change_inx = false;
 
                /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */
                for (i = 0; i < 4; i++) {
@@ -599,13 +599,8 @@ void WMMOnAssocRsp(struct adapter *padapter)
                                }
 
                                if (change_inx) {
-                                       tmp = edca[i];
-                                       edca[i] = edca[j];
-                                       edca[j] = tmp;
-
-                                       tmp = inx[i];
-                                       inx[i] = inx[j];
-                                       inx[j] = tmp;
+                                       swap(edca[i], edca[j]);
+                                       swap(inx[i], inx[j]);
 
                                        change_inx = false;
                                }