Skip to contentSkip to conversation

amd-xgbe: fix mismatched prototype

PATCH Applied Arnd Bergmann 6 participants 7 messages Feb 3, 2023 – Feb 16, 2023

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

PATCH 1/1 amd-xgbe: fix mismatched prototype

From: Arnd Bergmann <[email protected]>

The forward declaration was introduced with a prototype that does not match the function definition:

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
  391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Ideally there should not be any forward declarations here, which would make it easier to show that there is no unbounded recursion. I tried fixing this but could not figure out how to avoid the recursive call.

As a hotfix, address only the broken prototype to fix the build problem instead.

Fixes 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +2 -1
index 7d88caa4e623..16e7fb2c0dae 100644
@@ -390,7 +390,8 @@ static DEFINE_MUTEX(xgbe_phy_comm_lock);
 static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata);
 static void xgbe_phy_rrc(struct xgbe_prv_data *pdata);
 static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
-					unsigned int cmd, unsigned int sub_cmd);
+					enum xgbe_mb_cmd cmd,
+					enum xgbe_mb_subcmd sub_cmd);
 
 static int xgbe_phy_i2c_xfer(struct xgbe_prv_data *pdata,
 			     struct xgbe_i2c_op *i2c_op)
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The forward declaration was introduced with a prototype that does not match the function definition:

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
  391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Ideally there should not be any forward declarations here, which would make it easier to show that there is no unbounded recursion. I tried fixing this but could not figure out how to avoid the recursive call.

Quoted 5 lines

As a hotfix, address only the broken prototype to fix the build problem instead.

Fixes 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
Acked-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 17 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The forward declaration was introduced with a prototype that does not match the function definition:

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
  391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Ideally there should not be any forward declarations here, which would make it easier to show that there is no unbounded recursion. I tried fixing this but could not figure out how to avoid the recursive call.

Quoted 5 lines

As a hotfix, address only the broken prototype to fix the build problem instead.

Fixes 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")

Looks good to me.

Thanks,
Shyam

Quoted 19 lines
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +2 -1
index 7d88caa4e623..16e7fb2c0dae 100644
@@ -390,7 +390,8 @@ static DEFINE_MUTEX(xgbe_phy_comm_lock);
 static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata);
 static void xgbe_phy_rrc(struct xgbe_prv_data *pdata);
 static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
-					unsigned int cmd, unsigned int sub_cmd);
+					enum xgbe_mb_cmd cmd,
+					enum xgbe_mb_subcmd sub_cmd);
 
 static int xgbe_phy_i2c_xfer(struct xgbe_prv_data *pdata,
 			     struct xgbe_i2c_op *i2c_op)
maintainer
#3 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · On Fri, 3 Feb 2023 13:15:36 +0100 Arnd Bergmann wrote:

The forward declaration was introduced with a prototype that does not match the function definition:

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
  391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks for the fix. What's the compiler / extra flags you're using? Doesn't pop up on our setups..

#6 lore raw
In reply to Arnd Bergmann
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 5 lines · On Fri, 3 Feb 2023 13:15:36 +0100 you wrote:

From: Arnd Bergmann <[email protected]>

The forward declaration was introduced with a prototype that does not match the function definition:

Quoted 8 lines

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
  391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

Here is the summary with links:
- amd-xgbe: fix mismatched prototype

    https://git.kernel.org/netdev/net-next/c/bbe641866318

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#4 lore raw
In reply to Jakub Kicinski
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Fri, 3 Feb 2023 13:15:36 +0100 Arnd Bergmann wrote:

The forward declaration was introduced with a prototype that does not match the function definition:

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
  391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 3 lines

Thanks for the fix. What's the compiler / extra flags you're using? Doesn't pop up on our setups..

Yes please. Even this does not pop on our build systems too. Would like to know those extra compiler flags.

Thanks,
Shyam

maintainer
#5 lore raw
Quoted 14 lines · Shyam Sundar S K
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Fri, 3 Feb 2023 13:15:36 +0100 Arnd Bergmann wrote:

The forward declaration was introduced with a prototype that does not match the function definition:

drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:2166:13: error: conflicting types for 'xgbe_phy_perform_ratechange' due to enum/integer mismatch; have 'void(struct xgbe_prv_data *, enum xgbe_mb_cmd, enum xgbe_mb_subcmd)' [-Werror=enum-int-mismatch]
2166 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,

       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c:391:13: note: previous declaration of 'xgbe_phy_perform_ratechange' with type 'void(struct xgbe_prv_data *, unsigned int,  unsigned int)'
   391 | static void xgbe_phy_perform_ratechange(struct xgbe_prv_data *pdata,
       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 3 lines

Thanks for the fix. What's the compiler / extra flags you're using? Doesn't pop up on our setups..

Yes please. Even this does not pop on our build systems too. Would like to know those extra compiler flags.

Hi Arnd,

Gentle reminder!

Please share the compiler details / additional flags used to reproduce this warning.

Thanks,
Raju

Quoted 3 lines

Thanks,
Shyam