lkml.org 
[lkml]   [2022]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: wifi: mt7601u: eeprom: fix clang -Wformat warning
From
Date
Justin Stitt <justinstitt@google.com> wrote:

> 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>

Patch applied to wireless-next.git, thanks.

07db88f11e63 wifi: mt7601u: eeprom: fix clang -Wformat warning

--
https://patchwork.kernel.org/project/linux-wireless/patch/20220709001527.618593-1-justinstitt@google.com/

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

\
 
 \ /
  Last update: 2022-07-18 13:54    [W:0.137 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site