Skip to content

Commit

Permalink
staging: r8712u: Fix Smatch warning
Browse files Browse the repository at this point in the history
The patch 2080913: "staging: r8712u: Fix regression caused by
commit 8c213fa" from Feb 25, 2012, leads to the following Smatch
complaint:

drivers/staging/rtl8712/usb_intf.c:629 r871xu_dev_remove()
	 warn: variable dereferenced before check 'padapter' (see line 625)

The fix is to move the new statements inside the block where padapter
is not NULL.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Larry Finger authored and Greg Kroah-Hartman committed Mar 7, 2012
1 parent b76dee4 commit ee6aeff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/staging/rtl8712/usb_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,12 +620,12 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
struct _adapter *padapter = netdev_priv(pnetdev);
struct usb_device *udev = interface_to_usbdev(pusb_intf);

if (padapter->fw_found)
release_firmware(padapter->fw);
/* never exit with a firmware callback pending */
wait_for_completion(&padapter->rtl8712_fw_ready);
usb_set_intfdata(pusb_intf, NULL);
if (padapter) {
if (padapter->fw_found)
release_firmware(padapter->fw);
/* never exit with a firmware callback pending */
wait_for_completion(&padapter->rtl8712_fw_ready);
if (drvpriv.drv_registered == true)
padapter->bSurpriseRemoved = true;
if (pnetdev != NULL) {
Expand Down

0 comments on commit ee6aeff

Please sign in to comment.