From 4cb292a95f94ac5a6b8adc6a637de63b9430092a Mon Sep 17 00:00:00 2001 From: gwl Date: Thu, 26 Jun 2014 15:55:05 +0800 Subject: [PATCH] WiFi:bcmdhd: fix wifi driver endless loop when initialization fail. --- drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/aiutils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/aiutils.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/aiutils.c index ec3f537d6a31..b5b3cd171d43 100644 --- a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/aiutils.c +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/aiutils.c @@ -29,10 +29,11 @@ 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) { -- 2.34.1