Skip to content

Commit

Permalink
wilc1000: fix a loop timeout condition
Browse files Browse the repository at this point in the history
If the loop fails, the "while(trials--) {" loop will exit with "trials"
set to -1.  The test for that expects it to end with "trials" set to 0
so the warning message will not be printed.

Fix this by changing from a post-op to a pre-op.  This does mean that
we only make 99 attempts instead of 100 but that's okay.

Fixes: f135a15 ("wilc1000: Support chip sleep over SPI")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/YFS5gx/gi70zlIaO@mwanda
  • Loading branch information
Dan Carpenter authored and Kalle Valo committed Apr 17, 2021
1 parent c81852a commit 2f51061
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/microchip/wilc1000/wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ void chip_allow_sleep(struct wilc *wilc)
to_host_from_fw_bit = WILC_SPI_FW_TO_HOST_BIT;
}

while (trials--) {
while (--trials) {
ret = hif_func->hif_read_reg(wilc, to_host_from_fw_reg, &reg);
if (ret)
return;
Expand Down

0 comments on commit 2f51061

Please sign in to comment.