Re: [PATCH net-next] net/mlx5: rsc_dump and hv_vhca return NULL on create error

Simon Horman <[email protected]>
Newsgroups org.kernel.vger.linux-rdma,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
On Tue, Aug 11, 2026 at 09:16:37AM +0300, Tariq Toukan wrote:
> From: Michael Guralnik <[email protected]>
> 
> All callers of these create functions treat NULL and ERR_PTR as
> equivalent error cases. Align the return convention to NULL-on-failure
> to simplify the checks at usage sites.
> 
> Since its return value is never checked and failure is non-fatal, change
> hv_vhca init function to return void.
> 
> Signed-off-by: Michael Guralnik <[email protected]>
> Reviewed-by: Shay Drori <[email protected]>
> Signed-off-by: Tariq Toukan <[email protected]>

...

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/hv_vhca.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/hv_vhca.h

> @@ -63,9 +63,9 @@ static inline void mlx5_hv_vhca_destroy(struct mlx5_hv_vhca *hv_vhca)
>  {
>  }
>  
> -static inline int mlx5_hv_vhca_init(struct mlx5_hv_vhca *hv_vhca)
> +static inline void mlx5_hv_vhca_init(struct mlx5_hv_vhca *hv_vhca)
>  {
> -	return 0;
> +	return;
>  }

The AI-generated review on netdev-ai [1] points out that the
return; line is unnecessary and inconsistent with surrounding code.

[1] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260811061637.3195320-1-tariqt%40nvidia.com

But that not withstanding this looks good to me.

Reviewed-by: Simon Horman <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.