Skip to contentSkip to conversation

mlxsw: spectrum_router: fix xa_store() error checking

PATCH Applied Yuan Can 3 participants 3 messages Oct 17, 2024 – Oct 22, 2024

Subsystems (3)
lore
Share & tools
lore

Yuan Can

author
#0 lore raw

PATCH v2 1/1 mlxsw: spectrum_router: fix xa_store() error checking

It is meant to use xa_err() to extract the error encoded in the return value of xa_store().

Fixes 44c2fbebe18a ("mlxsw: spectrum_router: Share nexthop counters in resilient groups")

---
Changes since v1:
- Change target branch to net.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +3 -6
index 800dfb64ec83..7d6d859cef3f 100644
@@ -3197,7 +3197,6 @@ mlxsw_sp_nexthop_sh_counter_get(struct mlxsw_sp *mlxsw_sp,
 {
 	struct mlxsw_sp_nexthop_group *nh_grp = nh->nhgi->nh_grp;
 	struct mlxsw_sp_nexthop_counter *nhct;
-	void *ptr;
 	int err;
 
 	nhct = xa_load(&nh_grp->nhgi->nexthop_counters, nh->id);
@@ -3210,12 +3209,10 @@ mlxsw_sp_nexthop_sh_counter_get(struct mlxsw_sp *mlxsw_sp,
 	if (IS_ERR(nhct))
 		return nhct;
 
-	ptr = xa_store(&nh_grp->nhgi->nexthop_counters, nh->id, nhct,
-		       GFP_KERNEL);
-	if (IS_ERR(ptr)) {
-		err = PTR_ERR(ptr);
+	err = xa_err(xa_store(&nh_grp->nhgi->nexthop_counters, nh->id, nhct,
+			      GFP_KERNEL));
+	if (err)
 		goto err_store;
-	}
 
 	return nhct;
 
Signature · 1 line
2.17.1
#2 lore raw
In reply to Yuan Can
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Thu, 17 Oct 2024 10:32:23 +0800 you wrote:

It is meant to use xa_err() to extract the error encoded in the return value of xa_store().

Fixes 44c2fbebe18a ("mlxsw: spectrum_router: Share nexthop counters in resilient groups")

[...]

Here is the summary with links:
- [net,v2] mlxsw: spectrum_router: fix xa_store() error checking

    https://git.kernel.org/netdev/net/c/f7b4cf0306bb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html