netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t
@ 2024-10-14 10:48 Simon Horman
  2024-10-14 10:48 ` [PATCH 1/2] net: fec_mpc52xx_phy: " Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Simon Horman @ 2024-10-14 10:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Pantelis Antoniou, Geert Uytterhoeven, netdev, linux-kernel,
	linuxppc-dev

Hi,

This short series addersses the formatting of variables of
type resource_size_t in freescale drivers.

The correct format string for resource_size_t is %pa which
acts on the address of the variable to be formatted [1].

[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229

These problems were introduced by
commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/netdev/711d7f6d-b785-7560-f4dc-c6aad2cce99@linux-m68k.org/

---
Simon Horman (2):
      net: fec_mpc52xx_phy: Use %pa to format resource_size_t
      net: ethernet: fs_enet: Use %pa to format resource_size_t

 drivers/net/ethernet/freescale/fec_mpc52xx_phy.c     | 2 +-
 drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

base-commit: 6aac56631831e1386b6edd3c583c8afb2abfd267


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] net: fec_mpc52xx_phy: Use %pa to format resource_size_t
  2024-10-14 10:48 [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t Simon Horman
@ 2024-10-14 10:48 ` Simon Horman
  2024-10-14 10:48 ` [PATCH 2/2] net: ethernet: fs_enet: " Simon Horman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2024-10-14 10:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Pantelis Antoniou, Geert Uytterhoeven, netdev, linux-kernel,
	linuxppc-dev

The correct format string for resource_size_t is %pa which
acts on the address of the variable to be formatted [1].

[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229

Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")

Flagged by gcc-14 as:

drivers/net/ethernet/freescale/fec_mpc52xx_phy.c: In function 'mpc52xx_fec_mdio_probe':
drivers/net/ethernet/freescale/fec_mpc52xx_phy.c:97:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
   97 |         snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
      |                                             ~^   ~~~~~~~~~
      |                                              |      |
      |                                              |      resource_size_t {aka long long unsigned int}
      |                                              unsigned int
      |                                             %llx

No functional change intended.
Compile tested only.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/netdev/711d7f6d-b785-7560-f4dc-c6aad2cce99@linux-m68k.org/
Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/freescale/fec_mpc52xx_phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c b/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c
index 2c37004bb0fe..3d073f0fae63 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c
@@ -94,7 +94,7 @@ static int mpc52xx_fec_mdio_probe(struct platform_device *of)
 		goto out_free;
 	}
 
-	snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
+	snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res.start);
 	bus->priv = priv;
 
 	bus->parent = dev;

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] net: ethernet: fs_enet: Use %pa to format resource_size_t
  2024-10-14 10:48 [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t Simon Horman
  2024-10-14 10:48 ` [PATCH 1/2] net: fec_mpc52xx_phy: " Simon Horman
@ 2024-10-14 10:48 ` Simon Horman
  2024-10-15  7:24 ` [PATCH 0/2] net: ethernet: freescale: " Daniel Machon
  2024-10-15 18:00 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2024-10-14 10:48 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Pantelis Antoniou, Geert Uytterhoeven, netdev, linux-kernel,
	linuxppc-dev

The correct format string for resource_size_t is %pa which
acts on the address of the variable to be formatted [1].

[1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229

Introduced by commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")

Flagged by gcc-14 as:

drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c: In function 'fs_mii_bitbang_init':
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c:126:46: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
  126 |         snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
      |                                             ~^   ~~~~~~~~~
      |                                              |      |
      |                                              |      resource_size_t {aka long long unsigned int}
      |                                              unsigned int
      |                                             %llx

No functional change intended.
Compile tested only.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/netdev/711d7f6d-b785-7560-f4dc-c6aad2cce99@linux-m68k.org/
Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
index e6b2d7452fe7..66038e2a4ae3 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
@@ -123,7 +123,7 @@ static int fs_mii_bitbang_init(struct mii_bus *bus, struct device_node *np)
 	 * we get is an int, and the odds of multiple bitbang mdio buses
 	 * is low enough that it's not worth going too crazy.
 	 */
-	snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
+	snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res.start);
 
 	data = of_get_property(np, "fsl,mdio-pin", &len);
 	if (!data || len != 4)

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t
  2024-10-14 10:48 [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t Simon Horman
  2024-10-14 10:48 ` [PATCH 1/2] net: fec_mpc52xx_phy: " Simon Horman
  2024-10-14 10:48 ` [PATCH 2/2] net: ethernet: fs_enet: " Simon Horman
@ 2024-10-15  7:24 ` Daniel Machon
  2024-10-15 12:10   ` Simon Horman
  2024-10-15 18:00 ` patchwork-bot+netdevbpf
  3 siblings, 1 reply; 6+ messages in thread
From: Daniel Machon @ 2024-10-15  7:24 UTC (permalink / raw)
  To: Simon Horman
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Pantelis Antoniou, Geert Uytterhoeven, netdev, linux-kernel,
	linuxppc-dev

> Hi,
> 
> This short series addersses the formatting of variables of
> type resource_size_t in freescale drivers.
> 
> The correct format string for resource_size_t is %pa which
> acts on the address of the variable to be formatted [1].
> 
> [1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
> 
> These problems were introduced by
> commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Closes: https://lore.kernel.org/netdev/711d7f6d-b785-7560-f4dc-c6aad2cce99@linux-m68k.org/
> 
> ---
> Simon Horman (2):
>       net: fec_mpc52xx_phy: Use %pa to format resource_size_t
>       net: ethernet: fs_enet: Use %pa to format resource_size_t
> 
>  drivers/net/ethernet/freescale/fec_mpc52xx_phy.c     | 2 +-
>  drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> base-commit: 6aac56631831e1386b6edd3c583c8afb2abfd267
> 

Hi Simon,

Is this for net-next? I dont see a target tree name :-)

Looking at the docs, %pa seems correct to me.

For the series:

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t
  2024-10-15  7:24 ` [PATCH 0/2] net: ethernet: freescale: " Daniel Machon
@ 2024-10-15 12:10   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2024-10-15 12:10 UTC (permalink / raw)
  To: Daniel Machon
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Pantelis Antoniou, Geert Uytterhoeven, netdev, linux-kernel,
	linuxppc-dev

On Tue, Oct 15, 2024 at 07:24:48AM +0000, Daniel Machon wrote:
> > Hi,
> > 
> > This short series addersses the formatting of variables of
> > type resource_size_t in freescale drivers.
> > 
> > The correct format string for resource_size_t is %pa which
> > acts on the address of the variable to be formatted [1].
> > 
> > [1] https://elixir.bootlin.com/linux/v6.11.3/source/Documentation/core-api/printk-formats.rst#L229
> > 
> > These problems were introduced by
> > commit 9d9326d3bc0e ("phy: Change mii_bus id field to a string")
> > 
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Closes: https://lore.kernel.org/netdev/711d7f6d-b785-7560-f4dc-c6aad2cce99@linux-m68k.org/
> > 
> > ---
> > Simon Horman (2):
> >       net: fec_mpc52xx_phy: Use %pa to format resource_size_t
> >       net: ethernet: fs_enet: Use %pa to format resource_size_t
> > 
> >  drivers/net/ethernet/freescale/fec_mpc52xx_phy.c     | 2 +-
> >  drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > base-commit: 6aac56631831e1386b6edd3c583c8afb2abfd267
> > 
> 
> Hi Simon,
> 
> Is this for net-next? I dont see a target tree name :-)

Hi Daniel,

Yes, it is. Sorry for forgetting to include that in the subject.

> Looking at the docs, %pa seems correct to me.
> 
> For the series:
> 
> Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t
  2024-10-14 10:48 [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t Simon Horman
                   ` (2 preceding siblings ...)
  2024-10-15  7:24 ` [PATCH 0/2] net: ethernet: freescale: " Daniel Machon
@ 2024-10-15 18:00 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-15 18:00 UTC (permalink / raw)
  To: Simon Horman
  Cc: davem, edumazet, kuba, pabeni, pantelis.antoniou, geert, netdev,
	linux-kernel, linuxppc-dev

Hello:

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

On Mon, 14 Oct 2024 11:48:06 +0100 you wrote:
> Hi,
> 
> This short series addersses the formatting of variables of
> type resource_size_t in freescale drivers.
> 
> The correct format string for resource_size_t is %pa which
> acts on the address of the variable to be formatted [1].
> 
> [...]

Here is the summary with links:
  - [1/2] net: fec_mpc52xx_phy: Use %pa to format resource_size_t
    https://git.kernel.org/netdev/net-next/c/020bfdc4ed94
  - [2/2] net: ethernet: fs_enet: Use %pa to format resource_size_t
    https://git.kernel.org/netdev/net-next/c/45fe45fada26

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-15 18:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 10:48 [PATCH 0/2] net: ethernet: freescale: Use %pa to format resource_size_t Simon Horman
2024-10-14 10:48 ` [PATCH 1/2] net: fec_mpc52xx_phy: " Simon Horman
2024-10-14 10:48 ` [PATCH 2/2] net: ethernet: fs_enet: " Simon Horman
2024-10-15  7:24 ` [PATCH 0/2] net: ethernet: freescale: " Daniel Machon
2024-10-15 12:10   ` Simon Horman
2024-10-15 18:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).