mirror_ubuntu-kernels/drivers/net/wireless/mediatek/mt7601u
Justin Stitt 68204a6965 wifi: mt7601u: fix clang -Wformat warning
When building with Clang we encounter this warning:
| drivers/net/wireless/mediatek/mt7601u/debugfs.c:92:6: error: format
| specifies type 'unsigned char' but the argument has type 'int'
| [-Werror,-Wformat] dev->ee->reg.start + dev->ee->reg.num - 1);

The format specifier used is `%hhu` which describes a u8. Both
`dev->ee->reg.start` and `.num` are u8 as well. However, the expression
as a whole is promoted to an int as you cannot get smaller-than-int from
addition. Therefore, to fix the warning, use the promoted-to-type's
format specifier -- in this case `%d`.

example:
```
uint8_t a = 4, b = 7;
int size = sizeof(a + b - 1);
printf("%d\n", size);
// output: 4
```

See more:
(https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules)
"Integer types smaller than int are promoted when an operation is
performed on them. If all values of the original type can be represented
as an int, the value of the smaller type is converted to an int;
otherwise, it is converted to an unsigned int."

Signed-off-by: Justin Stitt <justinstitt@google.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220711212932.1501592-1-justinstitt@google.com
2022-07-18 14:54:23 +03:00
..
core.c
debugfs.c wifi: mt7601u: fix clang -Wformat warning 2022-07-18 14:54:23 +03:00
dma.c mt7601u: Remove redundant initialization of variable ret 2021-10-13 09:21:09 +03:00
dma.h
eeprom.c wifi: mt7601u: eeprom: fix clang -Wformat warning 2022-07-18 14:53:02 +03:00
eeprom.h
init.c mt7601u: enable TDLS support 2021-04-11 12:30:20 +03:00
initvals_phy.h
initvals.h
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mac.c mac80211: prepare sta handling for MLO support 2022-04-11 16:42:03 +02:00
mac.h
main.c wifi: mac80211: split bss_info_changed method 2022-06-20 12:55:09 +02:00
Makefile
mcu.c mt7601u: add missing release on skb in mt7601u_mcu_msg_send 2020-08-02 18:11:34 +03:00
mcu.h
mt7601u.h wifi: mac80211: change QoS settings API to take link into account 2022-07-15 11:43:15 +02:00
phy.c wifi: mac80211: move interface config to new struct 2022-06-20 12:55:03 +02:00
regs.h
trace.c
trace.h
tx.c wifi: mac80211: change QoS settings API to take link into account 2022-07-15 11:43:15 +02:00
usb.c mt7601u: add USB device ID for some versions of XiaoDu WiFi Dongle. 2021-06-22 18:25:17 +03:00
usb.h
util.c