Skip to content

Commit

Permalink
mlxsw: spectrum_router: fix xa_store() error checking
Browse files Browse the repository at this point in the history
It is meant to use xa_err() to extract the error encoded in the return
value of xa_store().

Fixes: 44c2fbe ("mlxsw: spectrum_router: Share nexthop counters in resilient groups")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Petr Machata <petrm@nvidia.com>
Link: https://patch.msgid.link/20241017023223.74180-1-yuancan@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Yuan Can authored and Paolo Abeni committed Oct 22, 2024
1 parent fa28755 commit f7b4cf0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;

Expand Down

0 comments on commit f7b4cf0

Please sign in to comment.