Commit 9a52028e authored by Adrian Bunk's avatar Adrian Bunk Committed by John W. Linville

wireless/libertas/if_cs.c: fix memory leaks

The leak in if_cs_prog_helper() is obvious.

It looks a bit as if not freeing "fw" in if_cs_prog_real() was done
intentionally, but I'm not seeing why it shouldn't be freed.
Reported-by: default avatarAdrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
Acked-by: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 667d4100
...@@ -595,7 +595,7 @@ static int if_cs_prog_helper(struct if_cs_card *card) ...@@ -595,7 +595,7 @@ static int if_cs_prog_helper(struct if_cs_card *card)
if (ret < 0) { if (ret < 0) {
lbs_pr_err("can't download helper at 0x%x, ret %d\n", lbs_pr_err("can't download helper at 0x%x, ret %d\n",
sent, ret); sent, ret);
goto done; goto err_release;
} }
if (count == 0) if (count == 0)
...@@ -604,9 +604,8 @@ static int if_cs_prog_helper(struct if_cs_card *card) ...@@ -604,9 +604,8 @@ static int if_cs_prog_helper(struct if_cs_card *card)
sent += count; sent += count;
} }
err_release:
release_firmware(fw); release_firmware(fw);
ret = 0;
done: done:
lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
return ret; return ret;
...@@ -676,14 +675,8 @@ static int if_cs_prog_real(struct if_cs_card *card) ...@@ -676,14 +675,8 @@ static int if_cs_prog_real(struct if_cs_card *card)
} }
ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a);
if (ret < 0) { if (ret < 0)
lbs_pr_err("firmware download failed\n"); lbs_pr_err("firmware download failed\n");
goto err_release;
}
ret = 0;
goto done;
err_release: err_release:
release_firmware(fw); release_firmware(fw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment