diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/hif_usb.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 74872ca76f9..46dc41a16fa 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -735,6 +735,14 @@ err: return -ENOMEM; } +static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) +{ + usb_kill_anchored_urbs(&hif_dev->regout_submitted); + ath9k_hif_usb_dealloc_reg_in_urb(hif_dev); + ath9k_hif_usb_dealloc_tx_urbs(hif_dev); + ath9k_hif_usb_dealloc_rx_urbs(hif_dev); +} + static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) { int transfer, err; @@ -794,14 +802,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, goto err_fw_req; } - /* Download firmware */ - ret = ath9k_hif_usb_download_fw(hif_dev); - if (ret) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: Firmware - %s download failed\n", fw_name); - goto err_fw_download; - } - /* Alloc URBs */ ret = ath9k_hif_usb_alloc_urbs(hif_dev); if (ret) { @@ -810,25 +810,25 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev, goto err_urb; } + /* Download firmware */ + ret = ath9k_hif_usb_download_fw(hif_dev); + if (ret) { + dev_err(&hif_dev->udev->dev, + "ath9k_htc: Firmware - %s download failed\n", fw_name); + goto err_fw_download; + } + return 0; -err_urb: - /* Nothing */ err_fw_download: + ath9k_hif_usb_dealloc_urbs(hif_dev); +err_urb: release_firmware(hif_dev->firmware); err_fw_req: hif_dev->firmware = NULL; return ret; } -static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) -{ - usb_kill_anchored_urbs(&hif_dev->regout_submitted); - ath9k_hif_usb_dealloc_reg_in_urb(hif_dev); - ath9k_hif_usb_dealloc_tx_urbs(hif_dev); - ath9k_hif_usb_dealloc_rx_urbs(hif_dev); -} - static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev) { ath9k_hif_usb_dealloc_urbs(hif_dev); @@ -859,21 +859,21 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, #endif usb_set_intfdata(interface, hif_dev); + hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb, + &hif_dev->udev->dev); + if (hif_dev->htc_handle == NULL) { + ret = -ENOMEM; + goto err_htc_hw_alloc; + } + ret = ath9k_hif_usb_dev_init(hif_dev, fw_name); if (ret) { ret = -EINVAL; goto err_hif_init_usb; } - hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev); - if (hif_dev->htc_handle == NULL) { - ret = -ENOMEM; - goto err_htc_hw_alloc; - } - - ret = ath9k_htc_hw_init(&hif_usb, hif_dev->htc_handle, hif_dev, - &hif_dev->udev->dev, hif_dev->device_id, - ATH9K_HIF_USB); + ret = ath9k_htc_hw_init(hif_dev->htc_handle, + &hif_dev->udev->dev, hif_dev->device_id); if (ret) { ret = -EINVAL; goto err_htc_hw_init; @@ -884,10 +884,10 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, return 0; err_htc_hw_init: - ath9k_htc_hw_free(hif_dev->htc_handle); -err_htc_hw_alloc: ath9k_hif_usb_dev_deinit(hif_dev); err_hif_init_usb: + ath9k_htc_hw_free(hif_dev->htc_handle); +err_htc_hw_alloc: usb_set_intfdata(interface, NULL); kfree(hif_dev); usb_put_dev(udev); |