2017-05-09 04:43:38

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

The name of an array used by itself will always return the array's address.
So these tests will always evaluate as false and therefore the _return_
will never be executed.

Signed-off-by: Gustavo A. R. Silva <[email protected]>
---
drivers/net/wireless/ath/ath10k/wmi.c | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 2f1743e..135cf83 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5933,15 +5933,6 @@ static struct sk_buff *ath10k_wmi_10_4_op_gen_init(struct ath10k *ar)

int ath10k_wmi_start_scan_verify(const struct wmi_start_scan_arg *arg)
{
- if (arg->ie_len && !arg->ie)
- return -EINVAL;
- if (arg->n_channels && !arg->channels)
- return -EINVAL;
- if (arg->n_ssids && !arg->ssids)
- return -EINVAL;
- if (arg->n_bssids && !arg->bssids)
- return -EINVAL;
-
if (arg->ie_len > WLAN_SCAN_PARAMS_MAX_IE_LEN)
return -EINVAL;
if (arg->n_channels > ARRAY_SIZE(arg->channels))
--
2.5.0


2017-05-09 12:20:43

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

Arend Van Spriel <[email protected]> writes:

> On 9-5-2017 7:33, Kalle Valo wrote:
>> "Gustavo A. R. Silva" <[email protected]> writes:
>>=20
>>> The name of an array used by itself will always return the array's addr=
ess.
>>> So these tests will always evaluate as false and therefore the _return_
>>> will never be executed.
>>>
>>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
>>=20
>> I don't understand the commit log, especially what does "The name of an
>> array used by itself" mean?
>
> The array fields in struct wmi_start_scan_arg that are checked here are
> fixed size arrays so they can never be NULL.
>
> Maybe that helps rephrasing this commit message.

Much much better, thanks!

--=20
Kalle Valo=

2017-05-09 12:08:05

by Arend Van Spriel

[permalink] [raw]
Subject: Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

On 9-5-2017 7:33, Kalle Valo wrote:
> "Gustavo A. R. Silva" <[email protected]> writes:
>
>> The name of an array used by itself will always return the array's address.
>> So these tests will always evaluate as false and therefore the _return_
>> will never be executed.
>>
>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
>
> I don't understand the commit log, especially what does "The name of an
> array used by itself" mean?

The array fields in struct wmi_start_scan_arg that are checked here are
fixed size arrays so they can never be NULL.

Maybe that helps rephrasing this commit message.

Regards,
Arend

2017-05-09 05:33:32

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

"Gustavo A. R. Silva" <[email protected]> writes:

> The name of an array used by itself will always return the array's addres=
s.
> So these tests will always evaluate as false and therefore the _return_
> will never be executed.
>
> Signed-off-by: Gustavo A. R. Silva <[email protected]>

I don't understand the commit log, especially what does "The name of an
array used by itself" mean?

--=20
Kalle Valo=

2017-05-09 12:55:19

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

Hi Arend,

Quoting Arend Van Spriel <[email protected]>:

> On 9-5-2017 7:33, Kalle Valo wrote:
>> "Gustavo A. R. Silva" <[email protected]> writes:
>>
>>> The name of an array used by itself will always return the array's address.
>>> So these tests will always evaluate as false and therefore the _return_
>>> will never be executed.
>>>
>>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
>>
>> I don't understand the commit log, especially what does "The name of an
>> array used by itself" mean?
>
> The array fields in struct wmi_start_scan_arg that are checked here are
> fixed size arrays so they can never be NULL.
>
> Maybe that helps rephrasing this commit message.
>

Definitely. Thank you!
--
Gustavo A. R. Silva

2017-05-09 12:00:43

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] net: wireless: ath: ath10k: remove unnecessary code

Hi Kalle,

Quoting Kalle Valo <[email protected]>:

> "Gustavo A. R. Silva" <[email protected]> writes:
>
>> The name of an array used by itself will always return the array's address.
>> So these tests will always evaluate as false and therefore the _return_
>> will never be executed.
>>
>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
>
> I don't understand the commit log, especially what does "The name of an
> array used by itself" mean?
>

Let me correct that and I'll send the patch again.

Thanks!
--
Gustavo A. R. Silva