staging: r8188eu: Fix a smatch warnings in core/rtw_recv.c
authorLarry Finger <Larry.Finger@lwfinger.net>
Wed, 4 Sep 2013 20:55:59 +0000 (15:55 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Sep 2013 14:47:45 +0000 (07:47 -0700)
Smatch reports the following:
drivers/staging/rtl8188eu/os_dep/recv_linux.c:227 rtw_recv_indicatepkt() warn: variable dereferenced before check 'precv_frame' (see line 139)

The test in this location is removed and added in the free routine.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_recv.c
drivers/staging/rtl8188eu/os_dep/recv_linux.c

index 201165787362b6ea9d1b2a7613b1c8d7457dffe0..55851997f21c80fe094cbff706111fdd13d31b4c 100644 (file)
@@ -208,7 +208,8 @@ int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_
        struct recv_priv *precvpriv = &padapter->recvpriv;
 
 _func_enter_;
-
+       if (!precvframe)
+               return _FAIL;
        if (precvframe->u.hdr.pkt) {
                dev_kfree_skb_any(precvframe->u.hdr.pkt);/* free skb by driver */
                precvframe->u.hdr.pkt = NULL;
index e2f4e7d7717041621acfc29299d81cfe56ee66b5..c40ef1357117d0db7d96c85946a2e5b6a38980f7 100644 (file)
@@ -224,8 +224,7 @@ _func_exit_;
 _recv_indicatepkt_drop:
 
         /* enqueue back to free_recv_queue */
-       if (precv_frame)
-               rtw_free_recvframe(precv_frame, pfree_recv_queue);
+       rtw_free_recvframe(precv_frame, pfree_recv_queue);
 
 _func_exit_;
         return _FAIL;