wifi: ath9k: clean up function ath9k_hif_usb_resume
authorDongliang Mu <dzm91@hust.edu.cn>
Tue, 5 Sep 2023 01:35:56 +0000 (09:35 +0800)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 21 Sep 2023 08:03:58 +0000 (11:03 +0300)
In ath9k_hif_usb_resume, the error handling code calls
ath9k_hif_usb_dealloc_urbs twice in different paths.

To unify the error handling code, we move the else branch before
the if branch and drop one level of indentation of the if branch.

In addition, move the ret variable at the end of variable declarations
to be reverse x-mas tree order.

Note that this patch does not incur any functionability change.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230905013556.2595854-1-dzm91@hust.edu.cn
drivers/net/wireless/ath/ath9k/hif_usb.c

index e5414435b1414003c7857d62ed03d94bf84fcbd7..90cfe39aa433c939913c3ac5c8f0333a32ce1713 100644 (file)
@@ -1481,31 +1481,31 @@ static int ath9k_hif_usb_resume(struct usb_interface *interface)
 {
        struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
        struct htc_target *htc_handle = hif_dev->htc_handle;
-       int ret;
        const struct firmware *fw;
+       int ret;
 
        ret = ath9k_hif_usb_alloc_urbs(hif_dev);
        if (ret)
                return ret;
 
-       if (hif_dev->flags & HIF_USB_READY) {
-               /* request cached firmware during suspend/resume cycle */
-               ret = request_firmware(&fw, hif_dev->fw_name,
-                                      &hif_dev->udev->dev);
-               if (ret)
-                       goto fail_resume;
-
-               hif_dev->fw_data = fw->data;
-               hif_dev->fw_size = fw->size;
-               ret = ath9k_hif_usb_download_fw(hif_dev);
-               release_firmware(fw);
-               if (ret)
-                       goto fail_resume;
-       } else {
-               ath9k_hif_usb_dealloc_urbs(hif_dev);
-               return -EIO;
+       if (!(hif_dev->flags & HIF_USB_READY)) {
+               ret = -EIO;
+               goto fail_resume;
        }
 
+       /* request cached firmware during suspend/resume cycle */
+       ret = request_firmware(&fw, hif_dev->fw_name,
+                              &hif_dev->udev->dev);
+       if (ret)
+               goto fail_resume;
+
+       hif_dev->fw_data = fw->data;
+       hif_dev->fw_size = fw->size;
+       ret = ath9k_hif_usb_download_fw(hif_dev);
+       release_firmware(fw);
+       if (ret)
+               goto fail_resume;
+
        mdelay(100);
 
        ret = ath9k_htc_resume(htc_handle);