NFC: nxp-nci: Release firmware when switching to FW mode fails
authorSamuel Ortiz <sameo@linux.intel.com>
Sun, 5 Apr 2015 22:58:51 +0000 (00:58 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 5 Apr 2015 22:58:51 +0000 (00:58 +0200)
In that case, the firmware work will never be scheduled, will
never complete and thus the firmware will never be released.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/nxp-nci/firmware.c

index 74f98209ea82b73ad809ccb0991f73e9456393eb..5291797324bae0752098a15b6b3f7221c612b8ce 100644 (file)
@@ -234,8 +234,10 @@ int nxp_nci_fw_download(struct nci_dev *ndev, const char *firmware_name)
                goto fw_download_exit;
 
        r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_FW);
-       if (r < 0)
+       if (r < 0) {
+               release_firmware(fw_info->fw);
                goto fw_download_exit;
+       }
 
        info->mode = NXP_NCI_MODE_FW;