qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Thu, 5 Apr 2018 15:49:49 +0000 (10:49 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 25 Apr 2018 08:25:36 +0000 (11:25 +0300)
In case memory resources for fw were succesfully allocated, release
them before jumping to fw_load_fail.

Addresses-Coverity-ID: 1466092 ("Resource leak")
Fixes: c3b2f7ca4186 ("qtnfmac: implement asynchronous firmware loading")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c

index f117904d9120564035dff4e27cc242f72fe95fc9..6c1e139bb8f7731d76225560ab271d27e7bbf15b 100644 (file)
@@ -1185,6 +1185,10 @@ static void qtnf_fw_work_handler(struct work_struct *work)
        if (qtnf_poll_state(&priv->bda->bda_ep_state, QTN_EP_FW_LOADRDY,
                            QTN_FW_DL_TIMEOUT_MS)) {
                pr_err("card is not ready\n");
+
+               if (!flashboot)
+                       release_firmware(fw);
+
                goto fw_load_fail;
        }