Re: [PATCH v1 net-next] net: ethernet: mellanox: mlx5: core: Use ERR_CAST() to return

From: Simon Horman
Date: Fri Sep 06 2024 - 03:32:29 EST


On Thu, Aug 29, 2024 at 04:14:04PM +0800, Yan Zhen wrote:
> Using ERR_CAST() is more reasonable and safer, When it is necessary
> to convert the type of an error pointer and return it.
>
> Signed-off-by: Yan Zhen <yanzhen@xxxxxxxx>

Thanks,

I agree that this change is correct.
And it seems to be the only case where this change is
relevant in this file.

And, personally, I do see a value in reducing naked casts,
even if the macro is doing much the same thing. Because
using a macro is more expressive about intent.

But, OTOH, I do see that there is a cost in terms of code-churn,
something for the maintainer to weigh-up.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>