staging: rtl8712: xmitframe_addmic(): Change return values and type
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Tue, 13 Aug 2019 04:46:35 +0000 (10:16 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Aug 2019 11:20:12 +0000 (13:20 +0200)
Change return values of xmitframe_addmic from _SUCCESS and _FAIL to 0
and -ENOMEM respectively. Modify call sites to check for non-zero values
instead of _FAIL.
Also change return type from sint to int.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190813044638.16348-1-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/rtl871x_xmit.c

index 178f8b96943b0717b6640ea98727cd7dafb53125..cc5809e49e356fa8ff77f4afa96165adc5c30964 100644 (file)
@@ -342,8 +342,8 @@ int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
        return 0;
 }
 
-static sint xmitframe_addmic(struct _adapter *padapter,
-                            struct xmit_frame *pxmitframe)
+static int xmitframe_addmic(struct _adapter *padapter,
+                           struct xmit_frame *pxmitframe)
 {
        u32     curfragnum, length;
        u8      *pframe, *payload, mic[8];
@@ -372,7 +372,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
                                if (!memcmp(psecuritypriv->XGrptxmickey
                                   [psecuritypriv->XGrpKeyid].skey,
                                   null_key, 16))
-                                       return _FAIL;
+                                       return -ENOMEM;
                                /*start to calculate the mic code*/
                                r8712_secmicsetkey(&micdata,
                                         psecuritypriv->
@@ -381,7 +381,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
                        } else {
                                if (!memcmp(&stainfo->tkiptxmickey.skey[0],
                                            null_key, 16))
-                                       return _FAIL;
+                                       return -ENOMEM;
                                /* start to calculate the mic code */
                                r8712_secmicsetkey(&micdata,
                                             &stainfo->tkiptxmickey.skey[0]);
@@ -442,7 +442,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
                        payload = payload - pattrib->last_txcmdsz + 8;
                }
        }
-       return _SUCCESS;
+       return 0;
 }
 
 static sint xmitframe_swencrypt(struct _adapter *padapter,
@@ -696,7 +696,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
                memcpy(mem_start, pbuf_start + TXDESC_OFFSET, pattrib->hdrlen);
        }
 
-       if (xmitframe_addmic(padapter, pxmitframe) == _FAIL)
+       if (xmitframe_addmic(padapter, pxmitframe))
                return _FAIL;
        xmitframe_swencrypt(padapter, pxmitframe);
        return _SUCCESS;