rtl8188eu: Fix smatch warning in hal/usb_ops_linux.c

Smatch shows the following:
  CHECK   /home/finger/rtl8188eu/hal/usb_ops_linux.c
/home/finger/rtl8188eu/hal/usb_ops_linux.c:630 usb_read_port() warn: variable dereferenced before check 'precvbuf' (see line 627)

The code is refactored.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-09-05 17:58:13 -05:00
parent 158597dcdd
commit 4749e2c19e

View file

@ -614,6 +614,11 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
_func_enter_;
if (!precvbuf) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_read_port:precvbuf ==NULL\n"));
return _FAIL;
}
if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
adapter->pwrctrlpriv.pnp_bstop_trx) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
@ -627,7 +632,6 @@ _func_enter_;
precvbuf->reuse = true;
}
if (precvbuf != NULL) {
rtl8188eu_init_recvbuf(adapter, precvbuf);
/* re-assign for linux based on skb */
@ -684,11 +688,6 @@ _func_enter_;
err, purb->status);
ret = _FAIL;
}
} else {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
("usb_read_port:precvbuf ==NULL\n"));
ret = _FAIL;
}
_func_exit_;
return ret;