diff mbox series

[1/2] ath11k: Fix error code in ath11k_core_suspend()

Message ID X9nF17L2/EKOSbn/@mwanda (mailing list archive)
State Accepted
Commit 9b09456258ea2f35fc8a99c4ac4829dcba0ca4be
Delegated to: Kalle Valo
Headers show
Series [1/2] ath11k: Fix error code in ath11k_core_suspend() | expand

Commit Message

Dan Carpenter Dec. 16, 2020, 8:31 a.m. UTC
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(-)

Comments

Kalle Valo Dec. 16, 2020, 9:06 a.m. UTC | #1
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.
Kalle Valo Dec. 16, 2020, 10:57 a.m. UTC | #2
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.
Kalle Valo Dec. 17, 2020, 6:48 a.m. UTC | #3
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()
diff mbox series

Patch

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