All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
       [not found] <cover.1519827461.git.lorenzo.bianconi@redhat.com>
@ 2018-02-28 14:26 ` Lorenzo Bianconi
  2018-02-28 15:06   ` Johannes Berg
                     ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Lorenzo Bianconi @ 2018-02-28 14:26 UTC (permalink / raw)
  To: kubakici; +Cc: linux-wireless

Fix the following sparse warning in mt7601u_efuse_physical_size_check:
- drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
  Variable length array is used

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
index da6faea092d6..a462064b5c91 100644
--- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
@@ -74,7 +74,7 @@ static int
 mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
 {
 	const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
-	u8 data[map_reads * 16];
+	u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
 	int ret, i;
 	u32 start = 0, end = 0, cnt_free;
 
-- 
2.14.3

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-02-28 14:26 ` [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check() Lorenzo Bianconi
@ 2018-02-28 15:06   ` Johannes Berg
  2018-02-28 16:01     ` Lorenzo Bianconi
  2018-02-28 19:46   ` Jakub Kicinski
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2018-02-28 15:06 UTC (permalink / raw)
  To: Lorenzo Bianconi, kubakici; +Cc: linux-wireless

On Wed, 2018-02-28 at 15:26 +0100, Lorenzo Bianconi wrote:
> 
>  	const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
> -	u8 data[map_reads * 16];
> +	u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
> 
You could turn it upside down and make 

const int map_reads = ARRAY_SIZE(data);

johannes

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-02-28 15:06   ` Johannes Berg
@ 2018-02-28 16:01     ` Lorenzo Bianconi
  2018-02-28 16:01       ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Lorenzo Bianconi @ 2018-02-28 16:01 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jakub Kicinski, linux-wireless

> On Wed, 2018-02-28 at 15:26 +0100, Lorenzo Bianconi wrote:
>>
>>       const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
>> -     u8 data[map_reads * 16];
>> +     u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
>>
> You could turn it upside down and make
>
> const int map_reads = ARRAY_SIZE(data);

map_reads is actually 2 since MT_EFUSE_USAGE_MAP_SIZE is 29. Using
ARRAY_SIZE(data) map_reads will be set to 32

Regards,
Lorenzo

>
> johannes

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-02-28 16:01     ` Lorenzo Bianconi
@ 2018-02-28 16:01       ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2018-02-28 16:01 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: Jakub Kicinski, linux-wireless

On Wed, 2018-02-28 at 17:01 +0100, Lorenzo Bianconi wrote:
> > On Wed, 2018-02-28 at 15:26 +0100, Lorenzo Bianconi wrote:
> > > 
> > >       const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
> > > -     u8 data[map_reads * 16];
> > > +     u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
> > > 
> > 
> > You could turn it upside down and make
> > 
> > const int map_reads = ARRAY_SIZE(data);
> 
> map_reads is actually 2 since MT_EFUSE_USAGE_MAP_SIZE is 29. Using
> ARRAY_SIZE(data) map_reads will be set to 32

Oh yeah, good point, sorry.

johannes

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-02-28 14:26 ` [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check() Lorenzo Bianconi
  2018-02-28 15:06   ` Johannes Berg
@ 2018-02-28 19:46   ` Jakub Kicinski
  2018-03-01 10:22   ` Bas Vermeulen
  2018-03-13 16:33   ` Kalle Valo
  3 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2018-02-28 19:46 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-wireless

On Wed, 28 Feb 2018 15:26:57 +0100, Lorenzo Bianconi wrote:
> Fix the following sparse warning in mt7601u_efuse_physical_size_check:
> - drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
>   Variable length array is used
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Acked-by: Jakub Kicinski <kubakici@wp.pl>

Thanks Lorenzo!

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-02-28 14:26 ` [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check() Lorenzo Bianconi
  2018-02-28 15:06   ` Johannes Berg
  2018-02-28 19:46   ` Jakub Kicinski
@ 2018-03-01 10:22   ` Bas Vermeulen
  2018-03-01 10:25     ` Bas Vermeulen
  2018-03-13 16:33   ` Kalle Valo
  3 siblings, 1 reply; 9+ messages in thread
From: Bas Vermeulen @ 2018-03-01 10:22 UTC (permalink / raw)
  To: Lorenzo Bianconi, kubakici; +Cc: linux-wireless



On 28-02-18 15:26, Lorenzo Bianconi wrote:
> Fix the following sparse warning in mt7601u_efuse_physical_size_check:
> - drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
>    Variable length array is used
>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
>   drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
> index da6faea092d6..a462064b5c91 100644
> --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
> +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
> @@ -74,7 +74,7 @@ static int
>   mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
>   {
>   	const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
> -	u8 data[map_reads * 16];
> +	u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
Shouldn't this be u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE,16)*16]; to 
get the
same array size as before?

Bas Vermeulen

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-03-01 10:22   ` Bas Vermeulen
@ 2018-03-01 10:25     ` Bas Vermeulen
  2018-03-01 10:51       ` Lorenzo Bianconi
  0 siblings, 1 reply; 9+ messages in thread
From: Bas Vermeulen @ 2018-03-01 10:25 UTC (permalink / raw)
  To: Lorenzo Bianconi, kubakici; +Cc: linux-wireless

Nevermind. round_up instead of DIV_ROUND_UP.

Bas Vermeulen


On 01-03-18 11:22, Bas Vermeulen wrote:
>
>
> On 28-02-18 15:26, Lorenzo Bianconi wrote:
>> Fix the following sparse warning in mt7601u_efuse_physical_size_check:
>> - drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
>>    Variable length array is used
>>
>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>> ---
>>   drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c 
>> b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>> index da6faea092d6..a462064b5c91 100644
>> --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>> +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>> @@ -74,7 +74,7 @@ static int
>>   mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
>>   {
>>       const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
>> -    u8 data[map_reads * 16];
>> +    u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
> Shouldn't this be u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE,16)*16]; to 
> get the
> same array size as before?
>
> Bas Vermeulen
>


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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

* Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-03-01 10:25     ` Bas Vermeulen
@ 2018-03-01 10:51       ` Lorenzo Bianconi
  0 siblings, 0 replies; 9+ messages in thread
From: Lorenzo Bianconi @ 2018-03-01 10:51 UTC (permalink / raw)
  To: Bas Vermeulen; +Cc: Jakub Kicinski, linux-wireless

> Nevermind. round_up instead of DIV_ROUND_UP.
>
> Bas Vermeulen
>
>
>
> On 01-03-18 11:22, Bas Vermeulen wrote:
>>
>>
>>
>> On 28-02-18 15:26, Lorenzo Bianconi wrote:
>>>
>>> Fix the following sparse warning in mt7601u_efuse_physical_size_check:
>>> - drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
>>>    Variable length array is used
>>>
>>> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
>>> ---
>>>   drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>>> b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>>> index da6faea092d6..a462064b5c91 100644
>>> --- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>>> +++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
>>> @@ -74,7 +74,7 @@ static int
>>>   mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
>>>   {
>>>       const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
>>> -    u8 data[map_reads * 16];
>>> +    u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
>>
>> Shouldn't this be u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE,16)*16]; to get
>> the
>> same array size as before?
>>
>> Bas Vermeulen
>>

round_up(MT_EFUSE_USAGE_MAP_SIZE, 16) =
(DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16) * 16) = 32

Regards,
Lorenzo

>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>

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

* Re: mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
  2018-02-28 14:26 ` [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check() Lorenzo Bianconi
                     ` (2 preceding siblings ...)
  2018-03-01 10:22   ` Bas Vermeulen
@ 2018-03-13 16:33   ` Kalle Valo
  3 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2018-03-13 16:33 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: kubakici, linux-wireless

Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> Fix the following sparse warning in mt7601u_efuse_physical_size_check:
> - drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
>   Variable length array is used
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> Acked-by: Jakub Kicinski <kubakici@wp.pl>

Patch applied to wireless-drivers-next.git, thanks.

3fb2f6a4db98 mt7601u: remove a warning in mt7601u_efuse_physical_size_check()

-- 
https://patchwork.kernel.org/patch/10247613/

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

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

end of thread, other threads:[~2018-03-13 16:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1519827461.git.lorenzo.bianconi@redhat.com>
2018-02-28 14:26 ` [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check() Lorenzo Bianconi
2018-02-28 15:06   ` Johannes Berg
2018-02-28 16:01     ` Lorenzo Bianconi
2018-02-28 16:01       ` Johannes Berg
2018-02-28 19:46   ` Jakub Kicinski
2018-03-01 10:22   ` Bas Vermeulen
2018-03-01 10:25     ` Bas Vermeulen
2018-03-01 10:51       ` Lorenzo Bianconi
2018-03-13 16:33   ` Kalle Valo

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.