net/mlx5e: add missing error code in error path

Add missing error code when mlx5e_macsec_fs_add_rule() or
mlx5e_macsec_fs_init() fails. mlx5e_macsec_fs_init() don't
return ERR_PTR(), so replace IS_ERR_OR_NULL() check with
NULL pointer check.

Fixes: e467b283ff ("net/mlx5e: Add MACsec TX steering rules")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20220914140100.3795545-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Yang Yingliang 2022-09-14 22:00:59 +08:00 committed by Jakub Kicinski
parent f3dcb3ed8e
commit 46ff47bc81

View File

@ -194,8 +194,10 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
MLX5_ACCEL_MACSEC_ACTION_DECRYPT;
macsec_rule = mlx5e_macsec_fs_add_rule(macsec->macsec_fs, ctx, &rule_attrs, &sa->fs_id);
if (IS_ERR_OR_NULL(macsec_rule))
if (!macsec_rule) {
err = -ENOMEM;
goto destroy_macsec_object;
}
sa->macsec_rule = macsec_rule;
@ -1294,8 +1296,10 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv)
macsec->mdev = mdev;
macsec_fs = mlx5e_macsec_fs_init(mdev, priv->netdev);
if (IS_ERR_OR_NULL(macsec_fs))
if (!macsec_fs) {
err = -ENOMEM;
goto err_out;
}
macsec->macsec_fs = macsec_fs;