From: Nathan Chancellor <nathan@kernel.org>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, vadfed@fb.com
Cc: arkadiusz.kubalewski@intel.com, jiri@resnulli.us,
netdev@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>,
saeedm@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org
Subject: [PATCH 2/2] mlx5: Fix type of mode parameter in mlx5_dpll_device_mode_get()
Date: Mon, 02 Oct 2023 13:55:21 -0700 [thread overview]
Message-ID: <20231002-net-wifpts-dpll_mode_get-v1-2-a356a16413cf@kernel.org> (raw)
In-Reply-To: <20231002-net-wifpts-dpll_mode_get-v1-0-a356a16413cf@kernel.org>
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
next prev parent reply other threads:[~2023-10-02 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231002-net-wifpts-dpll_mode_get-v1-2-a356a16413cf@kernel.org \
--to=nathan@kernel.org \
--cc=arkadiusz.kubalewski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patches@lists.linux.dev \
--cc=saeedm@nvidia.com \
--cc=vadfed@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).