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

net/mlx5: Fix return type mismatch in mlx5_esw_vport_vhca_id()

The function mlx5_esw_vport_vhca_id() is declared to return bool,
but returns -EOPNOTSUPP (-45), which is an int error code. This
causes a signedness bug as reported by smatch.

This patch fixes this smatch report:
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h:981 mlx5_esw_vport_vhca_id()
warn: signedness bug returning '(-45)'

Fixes: 1baf30426553 ("net/mlx5: E-Switch, Set/Query hca cap via vhca id")
Reviewed-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Zeng Chi <zengchi@kylinos.cn>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260123085749.1401969-1-zeng_chi911@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Zeng Chi and committed by
Jakub Kicinski
ca12c4a1 f0813bcd

+1 -1
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 1009 1009 static inline bool 1010 1010 mlx5_esw_vport_vhca_id(struct mlx5_eswitch *esw, u16 vportn, u16 *vhca_id) 1011 1011 { 1012 - return -EOPNOTSUPP; 1012 + return false; 1013 1013 } 1014 1014 1015 1015 #endif /* CONFIG_MLX5_ESWITCH */