Skip to content

Commit

Permalink
wireless, libertas: remove redundant NULL tests before calling releas…
Browse files Browse the repository at this point in the history
…e_firmware()

release_firmware() tests for, and deals gracefully with, NULL
pointers. Remove redundant explicit tests before calling the function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Jesper Juhl authored and John W. Linville committed Apr 12, 2012
1 parent d144f53 commit a7b957a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
6 changes: 2 additions & 4 deletions drivers/net/wireless/libertas/if_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
out1:
pcmcia_disable_device(p_dev);
out:
if (helper)
release_firmware(helper);
if (mainfw)
release_firmware(mainfw);
release_firmware(helper);
release_firmware(mainfw);

lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
return ret;
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/wireless/libertas/if_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,8 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
ret = 0;

out:
if (helper)
release_firmware(helper);
if (mainfw)
release_firmware(mainfw);
release_firmware(helper);
release_firmware(mainfw);

lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret);
return ret;
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/wireless/libertas/if_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,10 +1095,8 @@ static int if_spi_init_card(struct if_spi_card *card)
goto out;

out:
if (helper)
release_firmware(helper);
if (mainfw)
release_firmware(mainfw);
release_firmware(helper);
release_firmware(mainfw);

lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);

Expand Down
12 changes: 4 additions & 8 deletions drivers/net/wireless/libertas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,14 +1269,10 @@ int lbs_get_firmware(struct device *dev, const char *user_helper,

fail:
/* Failed */
if (*helper) {
release_firmware(*helper);
*helper = NULL;
}
if (*mainfw) {
release_firmware(*mainfw);
*mainfw = NULL;
}
release_firmware(*helper);
*helper = NULL;
release_firmware(*mainfw);
*mainfw = NULL;

return -ENOENT;
}
Expand Down

0 comments on commit a7b957a

Please sign in to comment.