From: Samuel Ortiz Date: Sun, 5 Apr 2015 22:58:51 +0000 (+0200) Subject: NFC: nxp-nci: Release firmware when switching to FW mode fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9421ce10ad87f799263bddad74b91e2166f020a1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git NFC: nxp-nci: Release firmware when switching to FW mode fails 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 --- diff --git a/drivers/nfc/nxp-nci/firmware.c b/drivers/nfc/nxp-nci/firmware.c index 74f98209ea82..5291797324ba 100644 --- a/drivers/nfc/nxp-nci/firmware.c +++ b/drivers/nfc/nxp-nci/firmware.c @@ -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;