From: Yang Yingliang <yangyingliang@huawei.com>
To: <netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>
Cc: <saeedm@nvidia.com>, <liorna@nvidia.com>, <raeds@nvidia.com>,
<davem@davemloft.net>
Subject: [PATCH -next 1/2] net/mlx5e: add missing error code in error path
Date: Tue, 13 Sep 2022 22:37:12 +0800 [thread overview]
Message-ID: <20220913143713.1998778-1-yangyingliang@huawei.com> (raw)
Add missing error code when mlx5e_macsec_fs_add_rule() or
mlx5e_macsec_fs_init() fails.
Fixes: e467b283ffd5 ("net/mlx5e: Add MACsec TX steering rules")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
.../ethernet/mellanox/mlx5/core/en_accel/macsec.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
index d9d18b039d8c..5fa3e22c8918 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
@@ -194,8 +194,13 @@ 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 (IS_ERR_OR_NULL(macsec_rule)) {
+ if (!macsec_rule)
+ err = -ENOMEM;
+ else
+ err = PTR_ERR(macsec_rule);
goto destroy_macsec_object;
+ }
sa->macsec_rule = macsec_rule;
@@ -1294,8 +1299,13 @@ 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 (IS_ERR_OR_NULL(macsec_fs)) {
+ if (!macsec_fs)
+ err = -ENOMEM;
+ else
+ err = PTR_ERR(macsec_fs);
goto err_out;
+ }
macsec->macsec_fs = macsec_fs;
--
2.25.1
next reply other threads:[~2022-09-13 15:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 14:37 Yang Yingliang [this message]
2022-09-13 14:37 ` [PATCH -next 2/2] net/mlx5e: Switch to kmemdup() when allocate dev_addr Yang Yingliang
2022-09-14 12:38 ` Raed Salem
2022-09-14 12:35 ` [PATCH -next 1/2] net/mlx5e: add missing error code in error path Raed Salem
2022-09-14 13:17 ` Yang Yingliang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220913143713.1998778-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=davem@davemloft.net \
--cc=linux-rdma@vger.kernel.org \
--cc=liorna@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=raeds@nvidia.com \
--cc=saeedm@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.