Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/mlx5: Fix compilation warning when USER_ACCESS isn't set

The cited commit made fs.c always compile, even when
INFINIBAND_USER_ACCESS isn't set. This results in a compilation
warning about an unused object when compiling with W=1 and
USER_ACCESS is unset.

Fix this by defining uverbs_destroy_def_handler() even when
USER_ACCESS isn't set.

Fixes: 36e0d433672f ("RDMA/mlx5: Compile fs.c regardless of INFINIBAND_USER_ACCESS config")
Link: https://patch.msgid.link/r/20250402070944.1022093-1-mbloch@nvidia.com
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Tested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Mark Bloch and committed by
Jason Gunthorpe
d247667e 95ba3850

+7 -2
-2
drivers/infiniband/hw/mlx5/fs.c
··· 3461 3461 &UVERBS_METHOD(MLX5_IB_METHOD_STEERING_ANCHOR_DESTROY)); 3462 3462 3463 3463 const struct uapi_definition mlx5_ib_flow_defs[] = { 3464 - #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) 3465 3464 UAPI_DEF_CHAIN_OBJ_TREE_NAMED( 3466 3465 MLX5_IB_OBJECT_FLOW_MATCHER), 3467 3466 UAPI_DEF_CHAIN_OBJ_TREE( ··· 3471 3472 UAPI_DEF_CHAIN_OBJ_TREE_NAMED( 3472 3473 MLX5_IB_OBJECT_STEERING_ANCHOR, 3473 3474 UAPI_DEF_IS_OBJ_SUPPORTED(mlx5_ib_shared_ft_allowed)), 3474 - #endif 3475 3475 {}, 3476 3476 }; 3477 3477
+7
include/rdma/ib_verbs.h
··· 4790 4790 4791 4791 struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile); 4792 4792 4793 + #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) 4793 4794 int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs); 4795 + #else 4796 + static inline int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs) 4797 + { 4798 + return 0; 4799 + } 4800 + #endif 4794 4801 4795 4802 struct net_device *rdma_alloc_netdev(struct ib_device *device, u32 port_num, 4796 4803 enum rdma_netdev_t type, const char *name,