WiFi:bcmdhd: fix wifi driver endless loop when initialization fail.
authorgwl <gwl@rock-chips.com>
Thu, 26 Jun 2014 07:55:05 +0000 (15:55 +0800)
committergwl <gwl@rock-chips.com>
Thu, 26 Jun 2014 07:56:01 +0000 (15:56 +0800)
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/aiutils.c

index ec3f537d6a319ac5338371db660a50409e2ca4a4..b5b3cd171d43854049d9aea337746d286bdbd3cf 100644 (file)
 static uint32
 get_erom_ent(si_t *sih, uint32 **eromptr, uint32 mask, uint32 match)
 {
-       uint32 ent;
+       uint32 ent = 0;
        uint inv = 0, nom = 0;
+       uint retry = 20;
 
-       while (TRUE) {
+       while (retry--) {
                ent = R_REG(si_osh(sih), *eromptr);
                (*eromptr)++;
 
@@ -52,6 +53,8 @@ get_erom_ent(si_t *sih, uint32 **eromptr, uint32 mask, uint32 match)
 
                nom++;
        }
+    if (!retry)
+        SI_ERROR(("%s: WiFi read register fail, retry = %d.\n", __FUNCTION__, retry));
 
        SI_VMSG(("%s: Returning ent 0x%08x\n", __FUNCTION__, ent));
        if (inv + nom) {