ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend()
@ 2020-12-16  8:31 Dan Carpenter
  2020-12-16  8:32 ` [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss() Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-12-16  8:31 UTC (permalink / raw)
  To: Kalle Valo, Carl Huang; +Cc: kernel-janitors, linux-wireless, ath11k

The "if (!ret)" condition is inverted and it should be "if (ret)".  It
means that we return success when we had intended to return an error
code.

Fixes: d1b0c33850d2 ("ath11k: implement suspend for QCA6390 PCI devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index b97c38b9a270..350b7913622c 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -185,7 +185,7 @@ int ath11k_core_suspend(struct ath11k_base *ab)
 	ath11k_hif_ce_irq_disable(ab);
 
 	ret = ath11k_hif_suspend(ab);
-	if (!ret) {
+	if (ret) {
 		ath11k_warn(ab, "failed to suspend hif: %d\n", ret);
 		return ret;
 	}
-- 
2.29.2


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss()
  2020-12-16  8:31 [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Dan Carpenter
@ 2020-12-16  8:32 ` Dan Carpenter
  2020-12-16 11:01   ` Kalle Valo
  2020-12-16  9:06 ` [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Kalle Valo
  2020-12-17  6:48 ` Kalle Valo
  2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2020-12-16  8:32 UTC (permalink / raw)
  To: Kalle Valo, Carl Huang
  Cc: kernel-janitors, Carl Huang, linux-wireless, ath11k

All these conditions are reversed so presumably most of the function is
dead code.

Fixes: 0699940755e9 ("ath11k: pci: fix L1ss clock unstable problem")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/ath/ath11k/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 857647aa57c8..9f9a824a4c2d 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -274,7 +274,7 @@ static int ath11k_pci_fix_l1ss(struct ath11k_base *ab)
 				      PCIE_QSERDES_COM_SYSCLK_EN_SEL_REG,
 				      PCIE_QSERDES_COM_SYSCLK_EN_SEL_VAL,
 				      PCIE_QSERDES_COM_SYSCLK_EN_SEL_MSK);
-	if (!ret) {
+	if (ret) {
 		ath11k_warn(ab, "failed to set sysclk: %d\n", ret);
 		return ret;
 	}
@@ -283,7 +283,7 @@ static int ath11k_pci_fix_l1ss(struct ath11k_base *ab)
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG1_REG,
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG1_VAL,
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG_MSK);
-	if (!ret) {
+	if (ret) {
 		ath11k_warn(ab, "failed to set dtct config1 error: %d\n", ret);
 		return ret;
 	}
@@ -292,7 +292,7 @@ static int ath11k_pci_fix_l1ss(struct ath11k_base *ab)
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG2_REG,
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG2_VAL,
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG_MSK);
-	if (!ret) {
+	if (ret) {
 		ath11k_warn(ab, "failed to set dtct config2: %d\n", ret);
 		return ret;
 	}
@@ -301,7 +301,7 @@ static int ath11k_pci_fix_l1ss(struct ath11k_base *ab)
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG4_REG,
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG4_VAL,
 				      PCIE_USB3_PCS_MISC_OSC_DTCT_CONFIG_MSK);
-	if (!ret) {
+	if (ret) {
 		ath11k_warn(ab, "failed to set dtct config4: %d\n", ret);
 		return ret;
 	}
-- 
2.29.2


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend()
  2020-12-16  8:31 [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Dan Carpenter
  2020-12-16  8:32 ` [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss() Dan Carpenter
@ 2020-12-16  9:06 ` Kalle Valo
  2020-12-16 10:57   ` Kalle Valo
  2020-12-17  6:48 ` Kalle Valo
  2 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2020-12-16  9:06 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-wireless, Carl Huang, kernel-janitors, ath11k

Dan Carpenter <dan.carpenter@oracle.com> writes:

> The "if (!ret)" condition is inverted and it should be "if (ret)".  It
> means that we return success when we had intended to return an error
> code.
>
> Fixes: d1b0c33850d2 ("ath11k: implement suspend for QCA6390 PCI devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/wireless/ath/ath11k/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
> index b97c38b9a270..350b7913622c 100644
> --- a/drivers/net/wireless/ath/ath11k/core.c
> +++ b/drivers/net/wireless/ath/ath11k/core.c
> @@ -185,7 +185,7 @@ int ath11k_core_suspend(struct ath11k_base *ab)
>  	ath11k_hif_ce_irq_disable(ab);
>  
>  	ret = ath11k_hif_suspend(ab);
> -	if (!ret) {
> +	if (ret) {
>  		ath11k_warn(ab, "failed to suspend hif: %d\n", ret);
>  		return ret;
>  	}

I suspect I created these bugs while cleaning up the patches. But I
don't get how I missed them in testing, that's a mystery to me.

Anyway, I'll queue these two to v5.11.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend()
  2020-12-16  9:06 ` [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Kalle Valo
@ 2020-12-16 10:57   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2020-12-16 10:57 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, Carl Huang, linux-wireless, ath11k

Kalle Valo <kvalo@codeaurora.org> writes:

> Dan Carpenter <dan.carpenter@oracle.com> writes:
>
>> The "if (!ret)" condition is inverted and it should be "if (ret)".  It
>> means that we return success when we had intended to return an error
>> code.
>>
>> Fixes: d1b0c33850d2 ("ath11k: implement suspend for QCA6390 PCI devices")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>>  drivers/net/wireless/ath/ath11k/core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
>> index b97c38b9a270..350b7913622c 100644
>> --- a/drivers/net/wireless/ath/ath11k/core.c
>> +++ b/drivers/net/wireless/ath/ath11k/core.c
>> @@ -185,7 +185,7 @@ int ath11k_core_suspend(struct ath11k_base *ab)
>>  	ath11k_hif_ce_irq_disable(ab);
>>  
>>  	ret = ath11k_hif_suspend(ab);
>> -	if (!ret) {
>> +	if (ret) {
>>  		ath11k_warn(ab, "failed to suspend hif: %d\n", ret);
>>  		return ret;
>>  	}
>
> I suspect I created these bugs while cleaning up the patches. But I
> don't get how I missed them in testing, that's a mystery to me.

The warning was there:

[  297.186612] ath11k_pci 0000:06:00.0: failed to suspend hif: 0

But I had missed that because suspend was still working due to
ath11k_core_suspend() returning 0. I'll update the commit log and
mention about that spurious warning.

Thank you Dan, this was a very good catch! In the future I'll grep my
logs more carefully, updated my scripts already.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss()
  2020-12-16  8:32 ` [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss() Dan Carpenter
@ 2020-12-16 11:01   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2020-12-16 11:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-wireless, Carl Huang, kernel-janitors, ath11k

Dan Carpenter <dan.carpenter@oracle.com> writes:

> All these conditions are reversed so presumably most of the function is
> dead code.
>
> Fixes: 0699940755e9 ("ath11k: pci: fix L1ss clock unstable problem")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

And this caused a spurious warning:

[   95.734922] ath11k_pci 0000:06:00.0: failed to set sysclk: 0

I'll update the commit log.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend()
  2020-12-16  8:31 [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Dan Carpenter
  2020-12-16  8:32 ` [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss() Dan Carpenter
  2020-12-16  9:06 ` [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Kalle Valo
@ 2020-12-17  6:48 ` Kalle Valo
  2 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2020-12-17  6:48 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, Carl Huang, linux-wireless, ath11k

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The "if (!ret)" condition is inverted and it should be "if (ret)".  It means
> that we return success when we had intended to return an error code. This also
> caused a spurious warning even when the suspend was successful:
> 
> [  297.186612] ath11k_pci 0000:06:00.0: failed to suspend hif: 0
> 
> Fixes: d1b0c33850d2 ("ath11k: implement suspend for QCA6390 PCI devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

2 patches applied to ath-current branch of ath.git, thanks.

9b09456258ea ath11k: Fix error code in ath11k_core_suspend()
30d085039314 ath11k: Fix ath11k_pci_fix_l1ss()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/X9nF17L2/EKOSbn/@mwanda/

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


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

end of thread, other threads:[~2020-12-17  6:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16  8:31 [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Dan Carpenter
2020-12-16  8:32 ` [PATCH 2/2] ath11k: Fix ath11k_pci_fix_l1ss() Dan Carpenter
2020-12-16 11:01   ` Kalle Valo
2020-12-16  9:06 ` [PATCH 1/2] ath11k: Fix error code in ath11k_core_suspend() Kalle Valo
2020-12-16 10:57   ` Kalle Valo
2020-12-17  6:48 ` 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).