Skip to content

Commit f7b4cf0

Browse files
Yuan CanPaolo Abeni
authored andcommitted
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: 44c2fbe ("mlxsw: spectrum_router: Share nexthop counters in resilient groups") Signed-off-by: Yuan Can <[email protected]> Reviewed-by: Petr Machata <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Tested-by: Petr Machata <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent fa28755 commit f7b4cf0

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,6 @@ mlxsw_sp_nexthop_sh_counter_get(struct mlxsw_sp *mlxsw_sp,
31973197
{
31983198
struct mlxsw_sp_nexthop_group *nh_grp = nh->nhgi->nh_grp;
31993199
struct mlxsw_sp_nexthop_counter *nhct;
3200-
void *ptr;
32013200
int err;
32023201

32033202
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,
32103209
if (IS_ERR(nhct))
32113210
return nhct;
32123211

3213-
ptr = xa_store(&nh_grp->nhgi->nexthop_counters, nh->id, nhct,
3214-
GFP_KERNEL);
3215-
if (IS_ERR(ptr)) {
3216-
err = PTR_ERR(ptr);
3212+
err = xa_err(xa_store(&nh_grp->nhgi->nexthop_counters, nh->id, nhct,
3213+
GFP_KERNEL));
3214+
if (err)
32173215
goto err_store;
3218-
}
32193216

32203217
return nhct;
32213218

0 commit comments

Comments
 (0)