From 9840093505bffa3f153bda2ac4046b868486150d Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Wed, 4 Sep 2013 15:56:10 -0500 Subject: [PATCH] staging: r8188eu: Fix smatch warnings in core/rtw_recv.c Smatch reports the following: drivers/staging/rtl8188eu/core/rtw_recv.c:211 rtw_free_recvframe() warn: variable dereferenced before check 'precvframe' (see line 207) drivers/staging/rtl8188eu/core/rtw_recv.c:1803 amsdu_to_msdu() warn: variable dereferenced before check 'sub_skb' (see line 1784) The code was rearranged to eliminate the dereference before the check. Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_recv.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 55851997f21c..ba8e53463d10 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -204,12 +204,14 @@ void rtw_init_recvframe(union recv_frame *precvframe, struct recv_priv *precvpri int rtw_free_recvframe(union recv_frame *precvframe, struct __queue *pfree_recv_queue) { unsigned long irqL; - struct adapter *padapter = precvframe->u.hdr.adapter; - struct recv_priv *precvpriv = &padapter->recvpriv; + struct adapter *padapter; + struct recv_priv *precvpriv; _func_enter_; if (!precvframe) return _FAIL; + padapter = precvframe->u.hdr.adapter; + precvpriv = &padapter->recvpriv; if (precvframe->u.hdr.pkt) { dev_kfree_skb_any(precvframe->u.hdr.pkt);/* free skb by driver */ precvframe->u.hdr.pkt = NULL; @@ -1799,16 +1801,14 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe) memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); } - /* Indicat the packets to upper layer */ - if (sub_skb) { - /* Insert NAT2.5 RX here! */ - sub_skb->protocol = eth_type_trans(sub_skb, padapter->pnetdev); - sub_skb->dev = padapter->pnetdev; + /* Indicate the packets to upper layer */ + /* Insert NAT2.5 RX here! */ + sub_skb->protocol = eth_type_trans(sub_skb, padapter->pnetdev); + sub_skb->dev = padapter->pnetdev; - sub_skb->ip_summed = CHECKSUM_NONE; + sub_skb->ip_summed = CHECKSUM_NONE; - netif_rx(sub_skb); - } + netif_rx(sub_skb); } exit: -- 2.30.2