From: Rajkumar Manoharan <rmanohar@codeaurora.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org, kuba@kernel.org,
Bo YU <tsu.yubo@gmail.com>,
ath11k@lists.infradead.org, davem@davemloft.net
Subject: Re: [PATCH -next] ath11k: Add checked value for ath11k_ahb_remove
Date: Mon, 21 Sep 2020 10:21:34 -0700 [thread overview]
Message-ID: <4cc760ca8f79f1ce9df3aaf9dffe53b3@codeaurora.org> (raw)
In-Reply-To: <874knr5kfv.fsf@codeaurora.org>
On 2020-09-21 06:27, Kalle Valo wrote:
> Kalle Valo <kvalo@codeaurora.org> writes:
>
>> + rajkumar
>>
>> Bo YU <tsu.yubo@gmail.com> writes:
>>
>>> Return value form wait_for_completion_timeout should to be checked.
>>>
>>> This is detected by Coverity,#CID:1464479 (CHECKED_RETURN)
>>>
>>> FIXES: d5c65159f2895(ath11k: driver for Qualcomm IEEE 802.11ax
>>> devices)
>>
>> This should be
>>
>> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax
>> devices")
>>
>> But I can fix that.
>>
>>> --- a/drivers/net/wireless/ath/ath11k/ahb.c
>>> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
>>> @@ -981,12 +981,16 @@ static int ath11k_ahb_probe(struct
>>> platform_device *pdev)
>>> static int ath11k_ahb_remove(struct platform_device *pdev)
>>> {
>>> struct ath11k_base *ab = platform_get_drvdata(pdev);
>>> -
>>> + int ret = 0;
>>> reinit_completion(&ab->driver_recovery);
>>>
>>> if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags))
>>> - wait_for_completion_timeout(&ab->driver_recovery,
>>> - ATH11K_AHB_RECOVERY_TIMEOUT);
>>> + if (!wait_for_completion_timeout(&ab->driver_recovery,
>>> + ATH11K_AHB_RECOVERY_TIMEOUT)) {
>>> + ath11k_warn(ab, "fail to receive recovery response
>>> completion.\n");
>
>>> + ret = -ETIMEDOUT;
>>> + }
>>
>> This is a good find. Rajkumar, can you take a look if this is ok?
>
Sorry for the delay. wait_for_completion status check LGTM. But return 0
is
intentional as it is required to complete platform deinit properly.
Better
to improve the logging message.
>>>
>>> set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
>>> cancel_work_sync(&ab->restart_work);
>>> @@ -999,7 +1003,7 @@ static int ath11k_ahb_remove(struct
>>> platform_device *pdev)
>>> ath11k_core_free(ab);
>>> platform_set_drvdata(pdev, NULL);
>>>
>>> - return 0;
>>> + return ret;
>>> }
>>
>> Especially I wonder what happens if ath11k_ahb_remove() returns an
>> error. Should we just print a warning and return 0 instead?
>
> I changed this patch so that we return 0 even if timeout happens, just
> to be on the safe side. The patch is now in the pending branch.
>
Thanks for taking care of this.
Rajkumar
--
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
WARNING: multiple messages have this Message-ID (diff)
From: Rajkumar Manoharan <rmanohar@codeaurora.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Bo YU <tsu.yubo@gmail.com>,
kuba@kernel.org, linux-wireless@vger.kernel.org,
ath11k@lists.infradead.org, davem@davemloft.net
Subject: Re: [PATCH -next] ath11k: Add checked value for ath11k_ahb_remove
Date: Mon, 21 Sep 2020 10:21:34 -0700 [thread overview]
Message-ID: <4cc760ca8f79f1ce9df3aaf9dffe53b3@codeaurora.org> (raw)
In-Reply-To: <874knr5kfv.fsf@codeaurora.org>
On 2020-09-21 06:27, Kalle Valo wrote:
> Kalle Valo <kvalo@codeaurora.org> writes:
>
>> + rajkumar
>>
>> Bo YU <tsu.yubo@gmail.com> writes:
>>
>>> Return value form wait_for_completion_timeout should to be checked.
>>>
>>> This is detected by Coverity,#CID:1464479 (CHECKED_RETURN)
>>>
>>> FIXES: d5c65159f2895(ath11k: driver for Qualcomm IEEE 802.11ax
>>> devices)
>>
>> This should be
>>
>> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax
>> devices")
>>
>> But I can fix that.
>>
>>> --- a/drivers/net/wireless/ath/ath11k/ahb.c
>>> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
>>> @@ -981,12 +981,16 @@ static int ath11k_ahb_probe(struct
>>> platform_device *pdev)
>>> static int ath11k_ahb_remove(struct platform_device *pdev)
>>> {
>>> struct ath11k_base *ab = platform_get_drvdata(pdev);
>>> -
>>> + int ret = 0;
>>> reinit_completion(&ab->driver_recovery);
>>>
>>> if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags))
>>> - wait_for_completion_timeout(&ab->driver_recovery,
>>> - ATH11K_AHB_RECOVERY_TIMEOUT);
>>> + if (!wait_for_completion_timeout(&ab->driver_recovery,
>>> + ATH11K_AHB_RECOVERY_TIMEOUT)) {
>>> + ath11k_warn(ab, "fail to receive recovery response
>>> completion.\n");
>
>>> + ret = -ETIMEDOUT;
>>> + }
>>
>> This is a good find. Rajkumar, can you take a look if this is ok?
>
Sorry for the delay. wait_for_completion status check LGTM. But return 0
is
intentional as it is required to complete platform deinit properly.
Better
to improve the logging message.
>>>
>>> set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags);
>>> cancel_work_sync(&ab->restart_work);
>>> @@ -999,7 +1003,7 @@ static int ath11k_ahb_remove(struct
>>> platform_device *pdev)
>>> ath11k_core_free(ab);
>>> platform_set_drvdata(pdev, NULL);
>>>
>>> - return 0;
>>> + return ret;
>>> }
>>
>> Especially I wonder what happens if ath11k_ahb_remove() returns an
>> error. Should we just print a warning and return 0 instead?
>
> I changed this patch so that we return 0 even if timeout happens, just
> to be on the safe side. The patch is now in the pending branch.
>
Thanks for taking care of this.
Rajkumar
next prev parent reply other threads:[~2020-09-21 17:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-21 9:51 [PATCH -next] ath11k: Add checked value for ath11k_ahb_remove Bo YU
2020-09-07 10:27 ` Kalle Valo
2020-09-07 10:28 ` Kalle Valo
2020-09-21 13:27 ` Kalle Valo
2020-09-21 13:27 ` Kalle Valo
2020-09-21 17:21 ` Rajkumar Manoharan [this message]
2020-09-21 17:21 ` Rajkumar Manoharan
2020-09-22 7:41 ` Kalle Valo
2020-09-22 7:41 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4cc760ca8f79f1ce9df3aaf9dffe53b3@codeaurora.org \
--to=rmanohar@codeaurora.org \
--cc=ath11k@lists.infradead.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=tsu.yubo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.