net: wireless: bcmdhd: Fix crash on dhdsdio_probe_attach() failure

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt 2012-01-30 15:43:31 -08:00
parent 256a6b23be
commit dfc896e1c8
2 changed files with 21 additions and 4 deletions

View File

@ -2345,7 +2345,12 @@ dhd_open(struct net_device *net)
* We keep WEXT's wl_control_wl_start to provide backward compatibility
* This should be removed in the future
*/
wl_control_wl_start(net);
ret = wl_control_wl_start(net);
if (ret != 0) {
DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
ret = -1;
goto exit;
}
#endif
ifidx = dhd_net2idx(dhd, net);
@ -2367,8 +2372,14 @@ dhd_open(struct net_device *net)
atomic_set(&dhd->pend_8021x_cnt, 0);
#if defined(WL_CFG80211)
DHD_ERROR(("\n%s\n", dhd_version));
if (!dhd_download_fw_on_driverload)
wl_android_wifi_on(net);
if (!dhd_download_fw_on_driverload) {
ret = wl_android_wifi_on(net);
if (ret != 0) {
DHD_ERROR(("%s: failed with code %d\n", __FUNCTION__, ret));
ret = -1;
goto exit;
}
}
#endif /* defined(WL_CFG80211) */
if (dhd->pub.busstate != DHD_BUS_DATA) {

View File

@ -2785,6 +2785,9 @@ dhdsdio_download_state(dhd_bus_t *bus, bool enter)
uint retries;
int bcmerror = 0;
if (!bus->sih)
return BCME_ERROR;
/* To enter download state, disable ARM and reset SOCRAM.
* To exit download state, simply reset ARM (default is RAM boot).
*/
@ -5555,8 +5558,10 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
return TRUE;
fail:
if (bus->sih != NULL)
if (bus->sih != NULL) {
si_detach(bus->sih);
bus->sih = NULL;
}
return FALSE;
}
@ -5789,6 +5794,7 @@ dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, bool dongle_isolation, bool r
dhdsdio_clkctl(bus, CLK_NONE, FALSE);
}
si_detach(bus->sih);
bus->sih = NULL;
if (bus->vars && bus->varsz)
MFREE(osh, bus->vars, bus->varsz);
bus->vars = NULL;