linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume
@ 2023-09-05  1:35 Dongliang Mu
  2023-09-05 11:19 ` Dan Carpenter
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dongliang Mu @ 2023-09-05  1:35 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, Kalle Valo
  Cc: hust-os-kernel-patches, Dongliang Mu, linux-wireless,
	linux-kernel

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>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 34 ++++++++++++------------
 1 file changed, 17 insertions(+), 17 deletions(-)

v1->v2: move the else branch on top of if branch;
        move ret variable at the end of variable declarations;

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index e5414435b141..90cfe39aa433 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume
  2023-09-05  1:35 [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume Dongliang Mu
@ 2023-09-05 11:19 ` Dan Carpenter
  2023-09-05 11:54 ` Toke Høiland-Jørgensen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-09-05 11:19 UTC (permalink / raw)
  To: Dongliang Mu
  Cc: Toke Høiland-Jørgensen, Kalle Valo,
	hust-os-kernel-patches, linux-wireless, linux-kernel

On Tue, Sep 05, 2023 at 09:35:56AM +0800, Dongliang Mu wrote:
> 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>
> ---
>  drivers/net/wireless/ath/ath9k/hif_usb.c | 34 ++++++++++++------------
>  1 file changed, 17 insertions(+), 17 deletions(-)
> 
> v1->v2: move the else branch on top of if branch;
>         move ret variable at the end of variable declarations;

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume
  2023-09-05  1:35 [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume Dongliang Mu
  2023-09-05 11:19 ` Dan Carpenter
@ 2023-09-05 11:54 ` Toke Høiland-Jørgensen
  2023-09-05 17:33   ` Toke Høiland-Jørgensen
  2023-09-05 17:33 ` Toke Høiland-Jørgensen
  2023-09-21  8:04 ` Kalle Valo
  3 siblings, 1 reply; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-09-05 11:54 UTC (permalink / raw)
  To: Dongliang Mu, Kalle Valo
  Cc: hust-os-kernel-patches, Dongliang Mu, linux-wireless,
	linux-kernel

Dongliang Mu <dzm91@hust.edu.cn> writes:

> 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>

So it seems this didn't make it to the lists; could you please try
re-sending?

-Toke

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume
  2023-09-05 11:54 ` Toke Høiland-Jørgensen
@ 2023-09-05 17:33   ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-09-05 17:33 UTC (permalink / raw)
  To: Dongliang Mu, Kalle Valo
  Cc: hust-os-kernel-patches, Dongliang Mu, linux-wireless,
	linux-kernel

Toke Høiland-Jørgensen <toke@toke.dk> writes:

> Dongliang Mu <dzm91@hust.edu.cn> writes:
>
>> 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>
>
> So it seems this didn't make it to the lists; could you please try
> re-sending?

Never mind, it made it through now :)

-Toke

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume
  2023-09-05  1:35 [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume Dongliang Mu
  2023-09-05 11:19 ` Dan Carpenter
  2023-09-05 11:54 ` Toke Høiland-Jørgensen
@ 2023-09-05 17:33 ` Toke Høiland-Jørgensen
  2023-09-21  8:04 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-09-05 17:33 UTC (permalink / raw)
  To: Dongliang Mu, Kalle Valo
  Cc: hust-os-kernel-patches, Dongliang Mu, linux-wireless,
	linux-kernel

Dongliang Mu <dzm91@hust.edu.cn> writes:

> 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>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume
  2023-09-05  1:35 [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume Dongliang Mu
                   ` (2 preceding siblings ...)
  2023-09-05 17:33 ` Toke Høiland-Jørgensen
@ 2023-09-21  8:04 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2023-09-21  8:04 UTC (permalink / raw)
  To: Dongliang Mu
  Cc: Toke Høiland-Jørgensen, hust-os-kernel-patches,
	Dongliang Mu, linux-wireless, linux-kernel

Dongliang Mu <dzm91@hust.edu.cn> wrote:

> 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>

Patch applied to ath-next branch of ath.git, thanks.

dc73b2059354 wifi: ath9k: clean up function ath9k_hif_usb_resume

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230905013556.2595854-1-dzm91@hust.edu.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-21 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05  1:35 [PATCH v2] ath9k: clean up function ath9k_hif_usb_resume Dongliang Mu
2023-09-05 11:19 ` Dan Carpenter
2023-09-05 11:54 ` Toke Høiland-Jørgensen
2023-09-05 17:33   ` Toke Høiland-Jørgensen
2023-09-05 17:33 ` Toke Høiland-Jørgensen
2023-09-21  8:04 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).