diff mbox series

wifi: brcmfmac: Fix error return code in brcmf_sdio_download_firmware()

Message ID 1669716458-15327-1-git-send-email-wangyufen@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series wifi: brcmfmac: Fix error return code in brcmf_sdio_download_firmware() | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

wangyufen Nov. 29, 2022, 10:07 a.m. UTC
Fix to return a negative error code -EINVAL instead of 0.

Compile tested only.

Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Franky Lin Nov. 29, 2022, 5:41 p.m. UTC | #1
On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> wrote:
>
> Fix to return a negative error code -EINVAL instead of 0.
>
> Compile tested only.
>
> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> index 465d95d..329ec8ac 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus,
>         /* Take arm out of reset */
>         if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>                 brcmf_err("error getting out of ARM core reset\n");
> +               bcmerror = -EINVAL;

ENODEV seems more appropriate here.

>                 goto err;
>         }
>
> --
> 1.8.3.1
>
wangyufen Nov. 30, 2022, 2 a.m. UTC | #2
在 2022/11/30 1:41, Franky Lin 写道:
> On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> wrote:
>>
>> Fix to return a negative error code -EINVAL instead of 0.
>>
>> Compile tested only.
>>
>> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>> ---
>>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>> index 465d95d..329ec8ac 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus,
>>          /* Take arm out of reset */
>>          if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>>                  brcmf_err("error getting out of ARM core reset\n");
>> +               bcmerror = -EINVAL;
> 
> ENODEV seems more appropriate here.

However, if brcmf_chip_set_active()  fails in 
brcmf_pcie_exit_download_state(), "-EINVAL" is returned.
Is it necessary to keep consistent?

> 
>>                  goto err;
>>          }
>>
>> --
>> 1.8.3.1
>>
Arend van Spriel Nov. 30, 2022, 11:19 a.m. UTC | #3
On 11/30/2022 3:00 AM, wangyufen wrote:
> 
> 
> 在 2022/11/30 1:41, Franky Lin 写道:
>> On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> wrote:
>>>
>>> Fix to return a negative error code -EINVAL instead of 0.
>>>
>>> Compile tested only.
>>>
>>> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
>>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>>> ---
>>>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 
>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>> index 465d95d..329ec8ac 100644
>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct 
>>> brcmf_sdio *bus,
>>>          /* Take arm out of reset */
>>>          if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>>>                  brcmf_err("error getting out of ARM core reset\n");
>>> +               bcmerror = -EINVAL;
>>
>> ENODEV seems more appropriate here.
> 
> However, if brcmf_chip_set_active()  fails in 
> brcmf_pcie_exit_download_state(), "-EINVAL" is returned.
> Is it necessary to keep consistent?

If we can not get the ARM on the chip out of reset things will fail soon 
enough further down the road. Anyway, the other function calls return 
-EIO so let's do the same here.

Thanks,
Arend
wangyufen Dec. 1, 2022, 3:01 a.m. UTC | #4
在 2022/11/30 19:19, Arend van Spriel 写道:
> On 11/30/2022 3:00 AM, wangyufen wrote:
>>
>>
>> 在 2022/11/30 1:41, Franky Lin 写道:
>>> On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> wrote:
>>>>
>>>> Fix to return a negative error code -EINVAL instead of 0.
>>>>
>>>> Compile tested only.
>>>>
>>>> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
>>>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>>>> ---
>>>>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 
>>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>> index 465d95d..329ec8ac 100644
>>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct 
>>>> brcmf_sdio *bus,
>>>>          /* Take arm out of reset */
>>>>          if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>>>>                  brcmf_err("error getting out of ARM core reset\n");
>>>> +               bcmerror = -EINVAL;
>>>
>>> ENODEV seems more appropriate here.
>>
>> However, if brcmf_chip_set_active()  fails in 
>> brcmf_pcie_exit_download_state(), "-EINVAL" is returned.
>> Is it necessary to keep consistent?
> 
> If we can not get the ARM on the chip out of reset things will fail soon 
> enough further down the road. Anyway, the other function calls return 
> -EIO so let's do the same here.
> 

So -EIO is better?  Anyone else have any other opinions? 
Arend van Spriel Dec. 1, 2022, 6:18 a.m. UTC | #5
On December 1, 2022 4:01:39 AM wangyufen <wangyufen@huawei.com> wrote:

> 在 2022/11/30 19:19, Arend van Spriel 写道:
>> On 11/30/2022 3:00 AM, wangyufen wrote:
>>>
>>>
>>> 在 2022/11/30 1:41, Franky Lin 写道:
>>>> On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> wrote:
>>>>>
>>>>> Fix to return a negative error code -EINVAL instead of 0.
>>>>>
>>>>> Compile tested only.
>>>>>
>>>>> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
>>>>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>>>>> ---
>>>>>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>>>>>  1 file changed, 1 insertion(+)
>>>>>
>>>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>> index 465d95d..329ec8ac 100644
>>>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct
>>>>> brcmf_sdio *bus,
>>>>>         /* Take arm out of reset */
>>>>>         if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>>>>>                 brcmf_err("error getting out of ARM core reset\n");
>>>>> +               bcmerror = -EINVAL;
>>>>
>>>> ENODEV seems more appropriate here.
>>>
>>> However, if brcmf_chip_set_active()  fails in
>>> brcmf_pcie_exit_download_state(), "-EINVAL" is returned.
>>> Is it necessary to keep consistent?
>>
>> If we can not get the ARM on the chip out of reset things will fail soon
>> enough further down the road. Anyway, the other function calls return
>> -EIO so let's do the same here.
>
> So -EIO is better?  Anyone else have any other opinions? 
Kalle Valo Dec. 1, 2022, 11:16 a.m. UTC | #6
Arend Van Spriel <arend.vanspriel@broadcom.com> writes:

> On December 1, 2022 4:01:39 AM wangyufen <wangyufen@huawei.com> wrote:
>
>> 在 2022/11/30 19:19, Arend van Spriel 写道:
>>> On 11/30/2022 3:00 AM, wangyufen wrote:
>>>>
>>>>
>>>> 在 2022/11/30 1:41, Franky Lin 写道:
>>>>> On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> wrote:
>>>>>>
>>>>>> Fix to return a negative error code -EINVAL instead of 0.
>>>>>>
>>>>>> Compile tested only.
>>>>>>
>>>>>> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
>>>>>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>>>>>> ---
>>>>>>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>>>>>>  1 file changed, 1 insertion(+)
>>>>>>
>>>>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> index 465d95d..329ec8ac 100644
>>>>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct
>>>>>> brcmf_sdio *bus,
>>>>>>         /* Take arm out of reset */
>>>>>>         if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>>>>>>                 brcmf_err("error getting out of ARM core reset\n");
>>>>>> +               bcmerror = -EINVAL;
>>>>>
>>>>> ENODEV seems more appropriate here.
>>>>
>>>> However, if brcmf_chip_set_active()  fails in
>>>> brcmf_pcie_exit_download_state(), "-EINVAL" is returned.
>>>> Is it necessary to keep consistent?
>>>
>>> If we can not get the ARM on the chip out of reset things will fail soon
>>> enough further down the road. Anyway, the other function calls return
>>> -EIO so let's do the same here.
>>
>> So -EIO is better?  Anyone else have any other opinions? 
wangyufen Dec. 2, 2022, 4:59 a.m. UTC | #7
在 2022/12/1 14:18, Arend Van Spriel 写道:
> On December 1, 2022 4:01:39 AM wangyufen <wangyufen@huawei.com> wrote:
> 
>> 在 2022/11/30 19:19, Arend van Spriel 写道:
>>> On 11/30/2022 3:00 AM, wangyufen wrote:
>>>>
>>>>
>>>> 在 2022/11/30 1:41, Franky Lin 写道:
>>>>> On Tue, Nov 29, 2022 at 1:47 AM Wang Yufen <wangyufen@huawei.com> 
>>>>> wrote:
>>>>>>
>>>>>> Fix to return a negative error code -EINVAL instead of 0.
>>>>>>
>>>>>> Compile tested only.
>>>>>>
>>>>>> Fixes: d380ebc9b6fb ("brcmfmac: rename chip download functions")
>>>>>> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
>>>>>> ---
>>>>>>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
>>>>>>  1 file changed, 1 insertion(+)
>>>>>>
>>>>>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> index 465d95d..329ec8ac 100644
>>>>>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
>>>>>> @@ -3414,6 +3414,7 @@ static int brcmf_sdio_download_firmware(struct
>>>>>> brcmf_sdio *bus,
>>>>>>         /* Take arm out of reset */
>>>>>>         if (!brcmf_chip_set_active(bus->ci, rstvec)) {
>>>>>>                 brcmf_err("error getting out of ARM core reset\n");
>>>>>> +               bcmerror = -EINVAL;
>>>>>
>>>>> ENODEV seems more appropriate here.
>>>>
>>>> However, if brcmf_chip_set_active()  fails in
>>>> brcmf_pcie_exit_download_state(), "-EINVAL" is returned.
>>>> Is it necessary to keep consistent?
>>>
>>> If we can not get the ARM on the chip out of reset things will fail soon
>>> enough further down the road. Anyway, the other function calls return
>>> -EIO so let's do the same here.
>>
>> So -EIO is better?  Anyone else have any other opinions? 
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 465d95d..329ec8ac 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3414,6 +3414,7 @@  static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus,
 	/* Take arm out of reset */
 	if (!brcmf_chip_set_active(bus->ci, rstvec)) {
 		brcmf_err("error getting out of ARM core reset\n");
+		bcmerror = -EINVAL;
 		goto err;
 	}