From: Larry Finger Date: Wed, 4 Sep 2013 20:55:59 +0000 (-0500) Subject: staging: r8188eu: Fix a smatch warnings in core/rtw_recv.c X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9b276d2bd20ea2d20b45aab1b3c1700b7f2afa64;p=openwrt%2Fstaging%2Fblogic.git staging: r8188eu: Fix a smatch warnings in core/rtw_recv.c 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 201165787362..55851997f21c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -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; diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c b/drivers/staging/rtl8188eu/os_dep/recv_linux.c index e2f4e7d77170..c40ef1357117 100644 --- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c @@ -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;