mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
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
--- drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1 -1
@@ -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;
Signature · 1 line
2.14.3
drivers/net/wireless/mediatek/mt7601u/eeprom.c static int · line 77
Quoted 5 lines · Lorenzo Bianconi
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1
-1const 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
Quoted 9 lines · Lorenzo Bianconi
drivers/net/wireless/mediatek/mt7601u/eeprom.c static int · line 77
Quoted 5 lines
const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);drivers/net/wireless/mediatek/mt7601u/eeprom.c +1
-1-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
Quoted 2 lines
johannes
Quoted 7 lines · Lorenzo Bianconi
Quoted 7 lines · Lorenzo Bianconi
Quoted 5 lines
const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);drivers/net/wireless/mediatek/mt7601u/eeprom.c +1
-1-u8 data[map_reads *16 ]; +u8 data[round_up (MT_EFUSE_USAGE_MAP_SIZE ,16 )];
Quoted 6 lines
Quoted 3 lines
You could turn it upside down and make
const int
map_reads=ARRAY_SIZE(data);
map_readsis actually 2 sinceMT_EFUSE_USAGE_MAP_SIZEis 29. UsingARRAY_SIZE(data)map_readswill be set to 32
Oh yeah, good point, sorry.
johannes
Quoted 5 lines · Lorenzo Bianconi
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 usedSigned-off-by Lorenzo Bianconi <[email protected]>
Thanks Lorenzo!
Quoted 14 lines · Lorenzo Bianconi
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 usedSigned-off-by Lorenzo Bianconi <[email protected]>--- drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/mediatek/mt7601u/eeprom.c +0
-0
drivers/net/wireless/mediatek/mt7601u/eeprom.c static int · line 77
Quoted 5 lines
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1
-1@@ -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
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Nevermind. round_up instead of DIV_ROUND_UP.
Bas Vermeulen
Quoted 27 lines · Bas Vermeulen
Quoted 14 lines · Lorenzo Bianconi
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 usedSigned-off-by Lorenzo Bianconi <[email protected]>---
drivers/net/wireless/mediatek/mt7601u/eeprom.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/mediatek/mt7601u/eeprom.c +0
-0drivers/net/wireless/mediatek/mt7601u/eeprom.c static int · line 77
Quoted 5 lines
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1
-1@@ -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
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 39 lines
Nevermind.
round_upinstead ofDIV_ROUND_UP.Bas Vermeulen
Quoted 32 lines · Bas Vermeulen
Quoted 16 lines · Lorenzo Bianconi
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 usedSigned-off-by Lorenzo Bianconi <[email protected]>--- drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/mediatek/mt7601u/eeprom.c +0
-0drivers/net/wireless/mediatek/mt7601u/eeprom.c static int · line 77
Quoted 5 lines
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1
-1@@ -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
Quoted 7 lines
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Quoted 6 lines · Lorenzo Bianconi
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 usedSigned-off-by Lorenzo Bianconi <[email protected]>Acked-by Jakub Kicinski <[email protected]>
Patch applied to wireless-drivers-next.git, thanks.
3fb2f6a4db98 mt7601u: remove a warning in mt7601u_efuse_physical_size_check()
Signature · 3 lines
https://patchwork.kernel.org/patch/10247613/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches