diff mbox series

[net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()

Message ID ff2a5af67361988b3581831f7bd1eddebfb4c48f.1712082763.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Commit c120209bce34c49dcaba32f15679574327d09f63
Delegated to: Netdev Maintainers
Headers show
Series [net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 943 this patch: 943
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 954 this patch: 954
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 954 this patch: 954
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-03--09-00 (tests: 950)

Commit Message

Christophe JAILLET April 2, 2024, 6:33 p.m. UTC
The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
parameters in the same order.

Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:

   int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
				  int reg, u16 val);

it is likely that the definition is the one to change.

Found with cppcheck, funcArgOrderDifferent.

Fixes: ae271547bba6 ("net: dsa: sja1105: C45 only transactions for PCS")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Walle April 3, 2024, 8:06 a.m. UTC | #1
On Tue Apr 2, 2024 at 8:33 PM CEST, Christophe JAILLET wrote:
> The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
> parameters in the same order.
>
> Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
> in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:
>
>    int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
> 				  int reg, u16 val);
>
> it is likely that the definition is the one to change.

See also "struct mii_bus":

	/** @write_c45: Perform a C45 write transfer on the bus */
	int (*write_c45)(struct mii_bus *bus, int addr, int devnum,
			 int regnum, u16 val);

>
> Found with cppcheck, funcArgOrderDifferent.
>
> Fixes: ae271547bba6 ("net: dsa: sja1105: C45 only transactions for PCS")

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> ---
>  drivers/net/dsa/sja1105/sja1105_mdio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
> index 833e55e4b961..52ddb4ef259e 100644
> --- a/drivers/net/dsa/sja1105/sja1105_mdio.c
> +++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
> @@ -94,7 +94,7 @@ int sja1110_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
>  	return tmp & 0xffff;
>  }
>  
> -int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int reg, int mmd,
> +int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd, int reg,
>  			       u16 val)

Reviewed-by: Michael Walle <mwalle@kernel.org>

Vladimir, do you happen to know if some of your boards will use this
function? Just wondering because it was never noticed.

-michael

>  {
>  	struct sja1105_mdio_private *mdio_priv = bus->priv;
Vladimir Oltean April 3, 2024, 11:11 a.m. UTC | #2
On Wed, Apr 03, 2024 at 10:06:51AM +0200, Michael Walle wrote:
> Vladimir, do you happen to know if some of your boards will use this
> function? Just wondering because it was never noticed.
> 
> -michael

The SJA1110 uses the XPCS only for SGMII and 2500Base-X links. On the
Bluebox3 I have (which is currently in a cardboard box for the time
being, so I will have to rely on static analysis just like everybody
else), these links are the cascade ports between switches. However,
those cascade ports are only used for autonomous traffic bridging (the
board has a weird "H" topology). Traffic terminated on the CPU doesn't
go through the SGMII links, so this is why I haven't noticed it during
casual testing.

However, there are other NXP systems using downstream device trees which
are likely impacted, but they are on older kernels and probably haven't
seen the regression just yet. So the fix is welcome.
Vladimir Oltean April 3, 2024, 11:11 a.m. UTC | #3
On Tue, Apr 02, 2024 at 08:33:56PM +0200, Christophe JAILLET wrote:
> The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
> parameters in the same order.
> 
> Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
> in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:
> 
>    int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
> 				  int reg, u16 val);
> 
> it is likely that the definition is the one to change.
> 
> Found with cppcheck, funcArgOrderDifferent.
> 
> Fixes: ae271547bba6 ("net: dsa: sja1105: C45 only transactions for PCS")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
patchwork-bot+netdevbpf@kernel.org April 4, 2024, 11:20 a.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue,  2 Apr 2024 20:33:56 +0200 you wrote:
> The definition and declaration of sja1110_pcs_mdio_write_c45() don't have
> parameters in the same order.
> 
> Knowing that sja1110_pcs_mdio_write_c45() is used as a function pointer
> in 'sja1105_info' structure with .pcs_mdio_write_c45, and that we have:
> 
>    int (*pcs_mdio_write_c45)(struct mii_bus *bus, int phy, int mmd,
> 				  int reg, u16 val);
> 
> [...]

Here is the summary with links:
  - [net] net: dsa: sja1105: Fix parameters order in sja1110_pcs_mdio_write_c45()
    https://git.kernel.org/netdev/net/c/c120209bce34

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/sja1105/sja1105_mdio.c b/drivers/net/dsa/sja1105/sja1105_mdio.c
index 833e55e4b961..52ddb4ef259e 100644
--- a/drivers/net/dsa/sja1105/sja1105_mdio.c
+++ b/drivers/net/dsa/sja1105/sja1105_mdio.c
@@ -94,7 +94,7 @@  int sja1110_pcs_mdio_read_c45(struct mii_bus *bus, int phy, int mmd, int reg)
 	return tmp & 0xffff;
 }
 
-int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int reg, int mmd,
+int sja1110_pcs_mdio_write_c45(struct mii_bus *bus, int phy, int mmd, int reg,
 			       u16 val)
 {
 	struct sja1105_mdio_private *mdio_priv = bus->priv;