wifi: mt7601u: eeprom: fix clang -Wformat warning
authorJustin Stitt <justinstitt@google.com>
Sat, 9 Jul 2022 00:15:27 +0000 (17:15 -0700)
committerKalle Valo <kvalo@kernel.org>
Mon, 18 Jul 2022 11:53:02 +0000 (14:53 +0300)
commit07db88f11e63d78c5062447faf942745ce8959ff
treef3204725d67ead27b851b349fc33c175cf56ef28
parent0c574060060afa6ee18d99020634fe77b5c52c3d
wifi: mt7601u: eeprom: fix clang -Wformat warning

When building with Clang we encounter the following warning:
| drivers/net/wireless/mediatek/mt7601u/eeprom.c:193:5: error: format
| specifies type 'char' but the argument has type 'int' [-Werror,-Wformat]
| chan_bounds[idx].start + chan_bounds[idx].num - 1);

Variadic functions (printf-like) undergo default argument promotion.
Documentation/core-api/printk-formats.rst specifically recommends using
the promoted-to-type's format flag.

Moreover, C11 6.3.1.1 states:
(https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) `If an int
can represent all values of the original type ..., the value is
converted to an int; otherwise, it is converted to an unsigned int.
These are called the integer promotions.`

With this information in hand, we really should stop using `%hh[dxu]` or
`%h[dxu]` as they usually prompt Clang -Wformat warnings as well as go
against documented standard recommendations.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709001527.618593-1-justinstitt@google.com
drivers/net/wireless/mediatek/mt7601u/eeprom.c