Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: e467b283ffd5 ("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>

authored by

Yang Yingliang and committed by
Jakub Kicinski
46ff47bc f3dcb3ed

+6 -2
+6 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
··· 194 194 MLX5_ACCEL_MACSEC_ACTION_DECRYPT; 195 195 196 196 macsec_rule = mlx5e_macsec_fs_add_rule(macsec->macsec_fs, ctx, &rule_attrs, &sa->fs_id); 197 - if (IS_ERR_OR_NULL(macsec_rule)) 197 + if (!macsec_rule) { 198 + err = -ENOMEM; 198 199 goto destroy_macsec_object; 200 + } 199 201 200 202 sa->macsec_rule = macsec_rule; 201 203 ··· 1296 1294 macsec->mdev = mdev; 1297 1295 1298 1296 macsec_fs = mlx5e_macsec_fs_init(mdev, priv->netdev); 1299 - if (IS_ERR_OR_NULL(macsec_fs)) 1297 + if (!macsec_fs) { 1298 + err = -ENOMEM; 1300 1299 goto err_out; 1300 + } 1301 1301 1302 1302 macsec->macsec_fs = macsec_fs; 1303 1303