Skip to contentSkip to conversation

enetc: use correct format characters

PATCH Applied Bill Wendling 3 participants 4 messages Mar 16, 2022 – Mar 17, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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
---
 drivers/net/ethernet/freescale/enetc/enetc_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_mdio.c +1 -1
index 70e6d97b380f..1c8f5cc6dec4 100644
@@ -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;
 	}
Signature · 1 line
2.35.1.723.g4982287a31-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines

-----Original Message-----
From: Bill Wendling <[email protected]>
Sent: Wednesday, March 16, 2022 11:31 PM

[...]

Quoted 17 lines

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__);            \
                                        ~~~    ^~~~~~~~~~~
Quoted 5 lines

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
Fixes ebfcb23d62ab ("enetc: Add ENETC PF level external MDIO support")

Can be also net-next material. It's up to you. Thx.

#2 lore raw
Quoted 22 lines · Claudiu Manoil
Quoted 4 lines

-----Original Message-----
From: Bill Wendling <[email protected]>
Sent: Wednesday, March 16, 2022 11:31 PM

[...]

Quoted 17 lines

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__);            \
                                        ~~~    ^~~~~~~~~~~
Quoted 9 lines
Quoted 5 lines

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

Quoted 1 line

Can be also net-next material. It's up to you. Thx.

#3 lore raw
In reply to Bill Wendling
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 14 lines · 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__);            \
                                        ~~~    ^~~~~~~~~~~
Quoted 1 line

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html