netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] mlxsw: spectrum_router: fix xa_store() error checking
@ 2024-10-17  2:32 Yuan Can
  2024-10-17 17:05 ` Petr Machata
  2024-10-22 11:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yuan Can @ 2024-10-17  2:32 UTC (permalink / raw)
  To: idosch, petrm, davem, edumazet, kuba, pabeni, netdev; +Cc: yuancan

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")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
Changes since v1:
- Change target branch to net.
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 800dfb64ec83..7d6d859cef3f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -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;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] mlxsw: spectrum_router: fix xa_store() error checking
  2024-10-17  2:32 [PATCH net v2] mlxsw: spectrum_router: fix xa_store() error checking Yuan Can
@ 2024-10-17 17:05 ` Petr Machata
  2024-10-22 11:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Machata @ 2024-10-17 17:05 UTC (permalink / raw)
  To: Yuan Can; +Cc: idosch, petrm, davem, edumazet, kuba, pabeni, netdev


Yuan Can <yuancan@huawei.com> writes:

> 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")
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] mlxsw: spectrum_router: fix xa_store() error checking
  2024-10-17  2:32 [PATCH net v2] mlxsw: spectrum_router: fix xa_store() error checking Yuan Can
  2024-10-17 17:05 ` Petr Machata
@ 2024-10-22 11:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-22 11:10 UTC (permalink / raw)
  To: Yuan Can; +Cc: idosch, petrm, davem, edumazet, kuba, pabeni, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

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")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-22 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17  2:32 [PATCH net v2] mlxsw: spectrum_router: fix xa_store() error checking Yuan Can
2024-10-17 17:05 ` Petr Machata
2024-10-22 11:10 ` patchwork-bot+netdevbpf

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).