* [PATCH v1 net-next] net: ethernet: mellanox: mlx5: core: Use ERR_CAST() to return
@ 2024-08-29 8:14 Yan Zhen
2024-09-06 7:32 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Yan Zhen @ 2024-08-29 8:14 UTC (permalink / raw)
To: saeedm, tariqt, leon, davem, edumazet, kuba, pabeni
Cc: netdev, linux-rdma, linux-kernel, opensource.kernel, Yan Zhen
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@vivo.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
index 773624bb2c5d..2a0f70987749 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
@@ -130,7 +130,7 @@ static struct mlx5e_ethtool_table *get_flow_table(struct mlx5e_priv *priv,
ft_attr.autogroup.max_num_groups = MLX5E_ETHTOOL_NUM_GROUPS;
ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
if (IS_ERR(ft))
- return (void *)ft;
+ return ERR_CAST(ft);
eth_ft->ft = ft;
return eth_ft;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 net-next] net: ethernet: mellanox: mlx5: core: Use ERR_CAST() to return
2024-08-29 8:14 [PATCH v1 net-next] net: ethernet: mellanox: mlx5: core: Use ERR_CAST() to return Yan Zhen
@ 2024-09-06 7:32 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2024-09-06 7:32 UTC (permalink / raw)
To: Yan Zhen
Cc: saeedm, tariqt, leon, davem, edumazet, kuba, pabeni, netdev,
linux-rdma, linux-kernel, opensource.kernel
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@vivo.com>
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@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-06 7:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 8:14 [PATCH v1 net-next] net: ethernet: mellanox: mlx5: core: Use ERR_CAST() to return Yan Zhen
2024-09-06 7:32 ` Simon Horman
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).