Commit 683b505b authored by Brett Rudley's avatar Brett Rudley Committed by Greg Kroah-Hartman

staging: brcm80211: handle missing firmware better

Handle non-extistent firmware more gracefully.
Signed-off-by: default avatarBrett Rudley <brudley@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a200adb1
...@@ -187,6 +187,7 @@ static struct pci_device_id wl_id_table[] = { ...@@ -187,6 +187,7 @@ static struct pci_device_id wl_id_table[] = {
}; };
MODULE_DEVICE_TABLE(pci, wl_id_table); MODULE_DEVICE_TABLE(pci, wl_id_table);
static void __devexit wl_remove(struct pci_dev *pdev);
#endif /* !BCMSDIO */ #endif /* !BCMSDIO */
#ifdef BCMSDIO #ifdef BCMSDIO
...@@ -902,9 +903,11 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs, ...@@ -902,9 +903,11 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs,
#ifndef WLC_HIGH_ONLY #ifndef WLC_HIGH_ONLY
/* prepare ucode */ /* prepare ucode */
if (wl_request_fw(wl, (struct pci_dev *)btparam)) { if (wl_request_fw(wl, (struct pci_dev *)btparam)) {
printf("%s: %s driver failed\n", KBUILD_MODNAME, printf("%s: Failed to find firmware usually in %s\n",
EPI_VERSION_STR); KBUILD_MODNAME, "/lib/firmware/brcm");
goto fail; wl_release_fw(wl);
wl_remove((struct pci_dev *)btparam);
goto fail1;
} }
#endif #endif
...@@ -915,8 +918,8 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs, ...@@ -915,8 +918,8 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs,
wl_release_fw(wl); wl_release_fw(wl);
#endif #endif
if (!wl->wlc) { if (!wl->wlc) {
printf("%s: %s driver failed with code %d\n", KBUILD_MODNAME, printf("%s: %s wlc_attach() failed with code %d\n",
EPI_VERSION_STR, err); KBUILD_MODNAME, EPI_VERSION_STR, err);
goto fail; goto fail;
} }
wl->pub = wlc_pub(wl->wlc); wl->pub = wlc_pub(wl->wlc);
...@@ -1018,6 +1021,7 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs, ...@@ -1018,6 +1021,7 @@ static wl_info_t *wl_attach(uint16 vendor, uint16 device, ulong regs,
fail: fail:
wl_free(wl); wl_free(wl);
fail1:
return NULL; return NULL;
} }
...@@ -1189,9 +1193,6 @@ static void wl_dbus_disconnect_cb(void *arg) ...@@ -1189,9 +1193,6 @@ static void wl_dbus_disconnect_cb(void *arg)
} }
#endif /* WLC_HIGH_ONLY */ #endif /* WLC_HIGH_ONLY */
#ifndef BCMSDIO
static void __devexit wl_remove(struct pci_dev *pdev);
#endif
#define CHAN2GHZ(channel, freqency, chflags) { \ #define CHAN2GHZ(channel, freqency, chflags) { \
.band = IEEE80211_BAND_2GHZ, \ .band = IEEE80211_BAND_2GHZ, \
...@@ -1510,6 +1511,11 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1510,6 +1511,11 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0), wl = wl_attach(pdev->vendor, pdev->device, pci_resource_start(pdev, 0),
PCI_BUS, pdev, pdev->irq); PCI_BUS, pdev, pdev->irq);
if (!wl) {
WL_ERROR(("%s: %s: wl_attach failed!\n",
KBUILD_MODNAME, __func__));
return -ENODEV;
}
return 0; return 0;
err_1: err_1:
WL_ERROR(("%s: err_1: Major hoarkage\n", __func__)); WL_ERROR(("%s: err_1: Major hoarkage\n", __func__));
...@@ -1594,14 +1600,13 @@ static void __devexit wl_remove(struct pci_dev *pdev) ...@@ -1594,14 +1600,13 @@ static void __devexit wl_remove(struct pci_dev *pdev)
WL_ERROR(("wl: wl_remove: wlc_chipmatch failed\n")); WL_ERROR(("wl: wl_remove: wlc_chipmatch failed\n"));
return; return;
} }
if (wl->wlc) {
ieee80211_unregister_hw(hw); ieee80211_unregister_hw(hw);
WL_LOCK(wl);
WL_LOCK(wl); wl_down(wl);
wl_down(wl); WL_UNLOCK(wl);
WL_UNLOCK(wl); WL_NONE(("%s: Down\n", __func__));
WL_NONE(("%s: Down\n", __func__)); }
pci_disable_device(pdev); pci_disable_device(pdev);
wl_free(wl); wl_free(wl);
...@@ -2511,7 +2516,8 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) ...@@ -2511,7 +2516,8 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev)
WL_NONE(("request fw %s\n", fw_name)); WL_NONE(("request fw %s\n", fw_name));
status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); status = request_firmware(&wl->fw.fw_bin[i], fw_name, device);
if (status) { if (status) {
printf("fail to request firmware %s\n", fw_name); printf("%s: fail to load firmware %s\n",
KBUILD_MODNAME, fw_name);
wl_release_fw(wl); wl_release_fw(wl);
return status; return status;
} }
...@@ -2520,7 +2526,8 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev) ...@@ -2520,7 +2526,8 @@ static int wl_request_fw(wl_info_t *wl, struct pci_dev *pdev)
UCODE_LOADER_API_VER); UCODE_LOADER_API_VER);
status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device);
if (status) { if (status) {
printf("fail to request firmware %s\n", fw_name); printf("%s: fail to load firmware %s\n",
KBUILD_MODNAME, fw_name);
wl_release_fw(wl); wl_release_fw(wl);
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment