Skip to content

Commit

Permalink
staging: wilc1000: Fix some double unlock bugs in wilc_wlan_cleanup()
Browse files Browse the repository at this point in the history
If ->hif_read_reg() or ->hif_write_reg() fail then the code unlocks
and keeps executing.  It should just return.

Fixes: c5c77ba ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed May 20, 2019
1 parent ca641ba commit fea6991
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/staging/wilc1000/wilc_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,13 +1076,17 @@ void wilc_wlan_cleanup(struct net_device *dev)
acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP);

ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg);
if (!ret)
if (!ret) {
release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return;
}

ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
(reg | ABORT_INT));
if (!ret)
if (!ret) {
release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
return;
}

release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
wilc->hif_func->hif_deinit(NULL);
Expand Down

0 comments on commit fea6991

Please sign in to comment.