libertas: cap reset attempts to a maximum of 10
Marcelo Tosatti
marcelo at pentafluge.infradead.unroutableorg
Fri Nov 10 21:24:36 EST 2006
Commit: 5ce7f4883d31bac6908f96065930ffb4bef4d8db
Parent: 60c12005a047829eb8dece5ba6a0d3f19f97d19f
commit 5ce7f4883d31bac6908f96065930ffb4bef4d8db
Author: Marcelo Tosatti <marcelo at pentafluge.infradead.org>
AuthorDate: Fri Nov 10 03:39:01 2006 +0000
Commit: Marcelo Tosatti <marcelo at pentafluge.infradead.org>
CommitDate: Fri Nov 10 03:39:01 2006 +0000
libertas: cap reset attempts to a maximum of 10
The driver attempts to reset the device an unlimited amount of times
if it can't communicate: that can cause a silly infinite loop.
Cap the max. number of tries to 10.
Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
---
drivers/net/wireless/libertas/if_usb.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 4371c0a..7948673 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -1021,6 +1021,7 @@ int libertas_sbi_prog_firmware(wlan_priv
{
struct usb_card_rec *cardp = priv->wlan_dev.card;
int i = 0;
+ int reset_count = 10;
ENTER();
@@ -1060,7 +1061,8 @@ restart:
if (!cardp->FwDnldOver) {
PRINTM(FATAL, "Failed to load fw, resetting device!\n");
- if (!usb_reset_device(cardp->udev)) {
+ reset_count--;
+ if (!usb_reset_device(cardp->udev) && reset_count >= 0) {
msleep(10);
reset_device(priv);
msleep(10);
More information about the Commits-kernel
mailing list