diff mbox series

enetc: use correct format characters

Message ID 20220316213109.2352015-1-morbo@google.com (mailing list archive)
State Accepted
Commit df4d35e1f01f7a6d50bb098eaeed8b04ef422fdc
Delegated to: Netdev Maintainers
Headers show
Series enetc: use correct format characters | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Bill Wendling March 16, 2022, 9:31 p.m. UTC
When compiling with -Wformat, clang emits the following warning:

drivers/net/ethernet/freescale/enetc/enetc_mdio.c:151:22: warning:
format specifies type 'unsigned char' but the argument has type 'int'
[-Wformat]
                        phy_id, dev_addr, regnum);
                                          ^~~~~~
./include/linux/dev_printk.h:163:47: note: expanded from macro 'dev_dbg'
                dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
                                                    ~~~     ^~~~~~~~~~~
./include/linux/dev_printk.h:129:34: note: expanded from macro 'dev_printk'
                _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
                                        ~~~    ^~~~~~~~~~~

The types of these arguments are unconditionally defined, so this patch
updates the format character to the correct ones for ints and unsigned
ints.

Link: ClangBuiltLinux/linux#378
Signed-off-by: Bill Wendling <morbo@google.com>
---
 drivers/net/ethernet/freescale/enetc/enetc_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Claudiu Manoil March 17, 2022, 5:37 p.m. UTC | #1
> -----Original Message-----
> From: Bill Wendling <morbo@google.com>
> Sent: Wednesday, March 16, 2022 11:31 PM
[...]
> Subject: [PATCH] enetc: use correct format characters
> 
> When compiling with -Wformat, clang emits the following warning:
> 
> drivers/net/ethernet/freescale/enetc/enetc_mdio.c:151:22: warning:
> format specifies type 'unsigned char' but the argument has type 'int'
> [-Wformat]
>                         phy_id, dev_addr, regnum);
>                                           ^~~~~~
> ./include/linux/dev_printk.h:163:47: note: expanded from macro 'dev_dbg'
>                 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
>                                                     ~~~     ^~~~~~~~~~~
> ./include/linux/dev_printk.h:129:34: note: expanded from macro
> 'dev_printk'
>                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
>                                         ~~~    ^~~~~~~~~~~
> 
> The types of these arguments are unconditionally defined, so this patch
> updates the format character to the correct ones for ints and unsigned ints.
> 
> Link: ClangBuiltLinux/linux#378
> Signed-off-by: Bill Wendling <morbo@google.com>

Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Fixes: ebfcb23d62ab ("enetc: Add ENETC PF level external MDIO support")

Can be also net-next material. It's up to you. Thx.
Bill Wendling March 17, 2022, 6:51 p.m. UTC | #2
On Thu, Mar 17, 2022 at 10:37 AM Claudiu Manoil <claudiu.manoil@nxp.com> wrote:
>
> > -----Original Message-----
> > From: Bill Wendling <morbo@google.com>
> > Sent: Wednesday, March 16, 2022 11:31 PM
> [...]
> > Subject: [PATCH] enetc: use correct format characters
> >
> > When compiling with -Wformat, clang emits the following warning:
> >
> > drivers/net/ethernet/freescale/enetc/enetc_mdio.c:151:22: warning:
> > format specifies type 'unsigned char' but the argument has type 'int'
> > [-Wformat]
> >                         phy_id, dev_addr, regnum);
> >                                           ^~~~~~
> > ./include/linux/dev_printk.h:163:47: note: expanded from macro 'dev_dbg'
> >                 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
> >                                                     ~~~     ^~~~~~~~~~~
> > ./include/linux/dev_printk.h:129:34: note: expanded from macro
> > 'dev_printk'
> >                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
> >                                         ~~~    ^~~~~~~~~~~
> >
> > The types of these arguments are unconditionally defined, so this patch
> > updates the format character to the correct ones for ints and unsigned ints.
> >
> > Link: ClangBuiltLinux/linux#378
> > Signed-off-by: Bill Wendling <morbo@google.com>
>
> Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
> Fixes: ebfcb23d62ab ("enetc: Add ENETC PF level external MDIO support")
>
Thanks Claudiu.

Could you change the Link about to this one? It's a valid URL.

Link: https://github.com/ClangBuiltLinux/linux/issues/378

> Can be also net-next material. It's up to you. Thx.
patchwork-bot+netdevbpf@kernel.org March 17, 2022, 11:50 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 16 Mar 2022 14:31:09 -0700 you wrote:
> When compiling with -Wformat, clang emits the following warning:
> 
> drivers/net/ethernet/freescale/enetc/enetc_mdio.c:151:22: warning:
> format specifies type 'unsigned char' but the argument has type 'int'
> [-Wformat]
>                         phy_id, dev_addr, regnum);
>                                           ^~~~~~
> ./include/linux/dev_printk.h:163:47: note: expanded from macro 'dev_dbg'
>                 dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
>                                                     ~~~     ^~~~~~~~~~~
> ./include/linux/dev_printk.h:129:34: note: expanded from macro 'dev_printk'
>                 _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
>                                         ~~~    ^~~~~~~~~~~
> 
> [...]

Here is the summary with links:
  - enetc: use correct format characters
    https://git.kernel.org/netdev/net-next/c/df4d35e1f01f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
index 70e6d97b380f..1c8f5cc6dec4 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
@@ -147,7 +147,7 @@  int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 	/* return all Fs if nothing was there */
 	if (enetc_mdio_rd(mdio_priv, ENETC_MDIO_CFG) & MDIO_CFG_RD_ER) {
 		dev_dbg(&bus->dev,
-			"Error while reading PHY%d reg at %d.%hhu\n",
+			"Error while reading PHY%d reg at %d.%d\n",
 			phy_id, dev_addr, regnum);
 		return 0xffff;
 	}