mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 04:21:09 -04:00
net/mlx5e: psp: Expose only a fully initialized priv->psp
Currently, during PSP init, priv->psp is initialized to an incompletely
built psp struct. Additionally, on fs init failure priv->psp is reset to
NULL.
Change this so that only a fully initialized priv->psp is set, which
makes the code easier to reason about in failure scenarios.
Fixes: af2196f494 ("net/mlx5e: Implement PSP operations .assoc_add and .assoc_del")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260504181100.269334-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
ae9582cd0b
commit
50690733db
@@ -1139,22 +1139,18 @@ int mlx5e_psp_init(struct mlx5e_priv *priv)
|
||||
if (!psp)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->psp = psp;
|
||||
fs = mlx5e_accel_psp_fs_init(priv);
|
||||
if (IS_ERR(fs)) {
|
||||
err = PTR_ERR(fs);
|
||||
goto out_err;
|
||||
kfree(psp);
|
||||
return err;
|
||||
}
|
||||
|
||||
psp->fs = fs;
|
||||
priv->psp = psp;
|
||||
|
||||
mlx5_core_dbg(priv->mdev, "PSP attached to netdevice\n");
|
||||
return 0;
|
||||
|
||||
out_err:
|
||||
priv->psp = NULL;
|
||||
kfree(psp);
|
||||
return err;
|
||||
}
|
||||
|
||||
void mlx5e_psp_cleanup(struct mlx5e_priv *priv)
|
||||
|
||||
Reference in New Issue
Block a user