netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations
@ 2023-10-02 20:55 Nathan Chancellor
  2023-10-02 20:55 ` [PATCH 1/2] ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get() Nathan Chancellor
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nathan Chancellor @ 2023-10-02 20:55 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, vadfed
  Cc: arkadiusz.kubalewski, jiri, netdev, llvm, patches,
	Nathan Chancellor, richardcochran, jonathan.lemon, saeedm, leon,
	linux-rdma

Hi all,

This series fixes a couple of instances of
-Wincompatible-function-pointer-types-strict that were introduced by a
recent series that added a new type of ops, struct dpll_device_ops,
along with implementations of the callback ->mode_get() that had a
mismatched mode type.

This warning is not currently enabled for any build but I am planning on
submitting a patch to add it to W=1 to prevent new instances of the
warning from popping up while we try and fix the existing instances in
other drivers.

This series is based on current net-next but if they need to go into
individual maintainer trees, please feel free to take the patches
individually.

Cheers,
Nathan

---
Nathan Chancellor (2):
      ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get()
      mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get()

 drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 4 ++--
 drivers/ptp/ptp_ocp.c                          | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 35766690d675f63c111afa0a2f5286b74a5b5cc2
change-id: 20231002-net-wifpts-dpll_mode_get-268efa3df19b

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


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

* [PATCH 1/2] ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get()
  2023-10-02 20:55 [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Nathan Chancellor
@ 2023-10-02 20:55 ` Nathan Chancellor
  2023-10-02 20:55 ` [PATCH 2/2] mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get() Nathan Chancellor
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2023-10-02 20:55 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, vadfed
  Cc: arkadiusz.kubalewski, jiri, netdev, llvm, patches,
	Nathan Chancellor, richardcochran, jonathan.lemon

When building with -Wincompatible-function-pointer-types-strict, a
warning designed to catch potential kCFI failures at build time rather
than run time due to incorrect function pointer types, there is a
warning due to a mismatch between the type of the mode parameter in
ptp_ocp_dpll_mode_get() vs. what the function pointer prototype for
->mode_get() in 'struct dpll_device_ops' expects.

  drivers/ptp/ptp_ocp.c:4353:14: error: incompatible function pointer types initializing 'int (*)(const struct dpll_device *, void *, enum dpll_mode *, struct netlink_ext_ack *)' with an expression of type 'int (const struct dpll_device *, void *, u32 *, struct netlink_ext_ack *)' (aka 'int (const struct dpll_device *, void *, unsigned int *, struct netlink_ext_ack *)') [-Werror,-Wincompatible-function-pointer-types-strict]
   4353 |         .mode_get = ptp_ocp_dpll_mode_get,
        |                     ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.

Change the type of the mode parameter in ptp_ocp_dpll_mode_get() to
clear up the warning and avoid kCFI failures at run time.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
To: richardcochran@gmail.com
To: jonathan.lemon@gmail.com
---
 drivers/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 88d60a9b5731..07bc4f3de61d 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -4255,7 +4255,7 @@ static int ptp_ocp_dpll_state_get(const struct dpll_pin *pin, void *pin_priv,
 }
 
 static int ptp_ocp_dpll_mode_get(const struct dpll_device *dpll, void *priv,
-				 u32 *mode, struct netlink_ext_ack *extack)
+				 enum dpll_mode *mode, struct netlink_ext_ack *extack)
 {
 	*mode = DPLL_MODE_AUTOMATIC;
 	return 0;

-- 
2.42.0


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

* [PATCH 2/2] mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get()
  2023-10-02 20:55 [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Nathan Chancellor
  2023-10-02 20:55 ` [PATCH 1/2] ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get() Nathan Chancellor
@ 2023-10-02 20:55 ` Nathan Chancellor
  2023-10-03 13:37 ` [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Simon Horman
  2023-10-05  0:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2023-10-02 20:55 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, vadfed
  Cc: arkadiusz.kubalewski, jiri, netdev, llvm, patches,
	Nathan Chancellor, saeedm, leon, linux-rdma

When building with -Wincompatible-function-pointer-types-strict, a
warning designed to catch potential kCFI failures at build time rather
than run time due to incorrect function pointer types, there is a
warning due to a mismatch between the type of the mode parameter in
mlx5_dpll_device_mode_get() vs. what the function pointer prototype for
->mode_get() in 'struct dpll_device_ops' expects.

  drivers/net/ethernet/mellanox/mlx5/core/dpll.c:141:14: error: incompatible function pointer types initializing 'int (*)(const struct dpll_device *, void *, enum dpll_mode *, struct netlink_ext_ack *)' with an expression of type 'int (const struct dpll_device *, void *, u32 *, struct netlink_ext_ack *)' (aka 'int (const struct dpll_device *, void *, unsigned int *, struct netlink_ext_ack *)') [-Werror,-Wincompatible-function-pointer-types-strict]
    141 |         .mode_get = mlx5_dpll_device_mode_get,
        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

Change the type of the mode parameter in mlx5_dpll_device_mode_get() to
clear up the warning and avoid kCFI failures at run time.

Fixes: 496fd0a26bbf ("mlx5: Implement SyncE support using DPLL infrastructure")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
To: saeedm@nvidia.com
To: leon@kernel.org
Cc: linux-rdma@vger.kernel.org
---
 drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c
index 74f0c7867120..2cd81bb32c66 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c
@@ -121,8 +121,8 @@ static int mlx5_dpll_device_lock_status_get(const struct dpll_device *dpll,
 }
 
 static int mlx5_dpll_device_mode_get(const struct dpll_device *dpll,
-				     void *priv,
-				     u32 *mode, struct netlink_ext_ack *extack)
+				     void *priv, enum dpll_mode *mode,
+				     struct netlink_ext_ack *extack)
 {
 	*mode = DPLL_MODE_MANUAL;
 	return 0;

-- 
2.42.0


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

* Re: [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations
  2023-10-02 20:55 [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Nathan Chancellor
  2023-10-02 20:55 ` [PATCH 1/2] ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get() Nathan Chancellor
  2023-10-02 20:55 ` [PATCH 2/2] mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get() Nathan Chancellor
@ 2023-10-03 13:37 ` Simon Horman
  2023-10-05  0:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-10-03 13:37 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: davem, edumazet, kuba, pabeni, vadfed, arkadiusz.kubalewski, jiri,
	netdev, llvm, patches, richardcochran, jonathan.lemon, saeedm,
	leon, linux-rdma

On Mon, Oct 02, 2023 at 01:55:19PM -0700, Nathan Chancellor wrote:
> Hi all,
> 
> This series fixes a couple of instances of
> -Wincompatible-function-pointer-types-strict that were introduced by a
> recent series that added a new type of ops, struct dpll_device_ops,
> along with implementations of the callback ->mode_get() that had a
> mismatched mode type.
> 
> This warning is not currently enabled for any build but I am planning on
> submitting a patch to add it to W=1 to prevent new instances of the
> warning from popping up while we try and fix the existing instances in
> other drivers.
> 
> This series is based on current net-next but if they need to go into
> individual maintainer trees, please feel free to take the patches
> individually.
> 
> Cheers,
> Nathan
> 
> ---
> Nathan Chancellor (2):
>       ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get()
>       mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get()

For series,

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations
  2023-10-02 20:55 [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Nathan Chancellor
                   ` (2 preceding siblings ...)
  2023-10-03 13:37 ` [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Simon Horman
@ 2023-10-05  0:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-05  0:30 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: davem, edumazet, kuba, pabeni, vadfed, arkadiusz.kubalewski, jiri,
	netdev, llvm, patches, richardcochran, jonathan.lemon, saeedm,
	leon, linux-rdma

Hello:

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

On Mon, 02 Oct 2023 13:55:19 -0700 you wrote:
> Hi all,
> 
> This series fixes a couple of instances of
> -Wincompatible-function-pointer-types-strict that were introduced by a
> recent series that added a new type of ops, struct dpll_device_ops,
> along with implementations of the callback ->mode_get() that had a
> mismatched mode type.
> 
> [...]

Here is the summary with links:
  - [1/2] ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get()
    https://git.kernel.org/netdev/net-next/c/26cc115d590c
  - [2/2] mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get()
    https://git.kernel.org/netdev/net-next/c/f4ecb3d44a11

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] 5+ messages in thread

end of thread, other threads:[~2023-10-05  0:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 20:55 [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Nathan Chancellor
2023-10-02 20:55 ` [PATCH 1/2] ptp: Fix type of mode parameter in ptp_ocp_dpll_mode_get() Nathan Chancellor
2023-10-02 20:55 ` [PATCH 2/2] mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get() Nathan Chancellor
2023-10-03 13:37 ` [PATCH 0/2] Fix a couple recent instances of -Wincompatible-function-pointer-types-strict from ->mode_get() implementations Simon Horman
2023-10-05  0:30 ` 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).