In commit 
8c213fa "staging: r8712u: Use asynchronous firmware loading",
the command to release the firmware was placed in the wrong routine.
In combination with the bug introduced in commit 
a5ee652 "staging: r8712u:
Interface-state not fully tracked", the driver attempts to upload firmware
that had already been released. This bug is the source of one of the
problems in https://bugs.archlinux.org/task/27996#comment89833.
Tested-by: Alberto Lago Ballesteros <saniukeokusainaya@gmail.com>
Tested-by: Adrian <agib@gmx.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        r8712_free_assoc_resources(padapter);
        /*s2-4.*/
        r8712_free_network_queue(padapter);
-       release_firmware(padapter->fw);
-       /* never exit with a firmware callback pending */
-       wait_for_completion(&padapter->rtl8712_fw_ready);
        return 0;
 }
 
 
 
 #include <linux/usb.h>
 #include <linux/module.h>
+#include <linux/firmware.h>
 
 #include "osdep_service.h"
 #include "drv_types.h"
        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 (drvpriv.drv_registered == true)