DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 3/3] common/cnxk: check for error code in MAC address set
Date: Mon, 16 Oct 2023 12:34:37 +0530	[thread overview]
Message-ID: <20231016070437.2295803-3-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20231016070437.2295803-1-ndabilpuram@marvell.com>

Check for mbox error code in MAC address set.
Fixes: 313cc41830ec ("common/cnxk: support NIX MAC operations")

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/cnxk/roc_nix_mac.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_nix_mac.c b/drivers/common/cnxk/roc_nix_mac.c
index e2e87be525..2d1c29dd66 100644
--- a/drivers/common/cnxk/roc_nix_mac.c
+++ b/drivers/common/cnxk/roc_nix_mac.c
@@ -84,7 +84,7 @@ roc_nix_mac_addr_set(struct roc_nix *roc_nix, const uint8_t addr[])
 	struct cgx_mac_addr_set_or_get *req, *rsp;
 	struct dev *dev = &nix->dev;
 	struct mbox *mbox = mbox_get(dev->mbox);
-	int rc;
+	int rc = -ENOSPC;
 
 	if (roc_nix_is_vf_or_sdp(roc_nix)) {
 		rc = NIX_ERR_OP_NOTSUP;
@@ -97,6 +97,9 @@ roc_nix_mac_addr_set(struct roc_nix *roc_nix, const uint8_t addr[])
 	}
 
 	req = mbox_alloc_msg_cgx_mac_addr_set(mbox);
+	if (req == NULL)
+		goto exit;
+
 	req->index = nix->dmac_flt_idx;
 	mbox_memcpy(req->mac_addr, addr, PLT_ETHER_ADDR_LEN);
 
-- 
2.25.1


  parent reply	other threads:[~2023-10-16  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  7:04 [PATCH 1/3] net/cnxk: fix data offset extract logic in vector function Nithin Dabilpuram
2023-10-16  7:04 ` [PATCH 2/3] net/cnxk: add support to extract HW error for inline IPsec Nithin Dabilpuram
2023-10-16  7:04 ` Nithin Dabilpuram [this message]
2023-10-18  5:34   ` [PATCH 3/3] common/cnxk: check for error code in MAC address set Jerin Jacob

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=20231016070437.2295803-3-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.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 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).