From: Stephen Hemminger <stephen@networkplumber.org>
To: Bingbin Chen <chen.bingbin@zte.com.cn>
Cc: dev@dpdk.org
Subject: Re: [PATCH v1 14/14] net/zxdh: clean stat values
Date: Mon, 10 Feb 2025 10:19:39 -0800 [thread overview]
Message-ID: <20250210101939.4bc47c61@hermes.local> (raw)
In-Reply-To: <20250210015017.4105624-9-chen.bingbin@zte.com.cn>
On Mon, 10 Feb 2025 09:50:17 +0800
Bingbin Chen <chen.bingbin@zte.com.cn> wrote:
> +static uint32_t
> +zxdh_np_se_smmu0_ind_read(uint32_t dev_id,
> + uint32_t base_addr,
> + uint32_t index,
> + uint32_t rd_mode,
> + uint32_t rd_clr_mode,
> + uint32_t *p_data)
> +{
> + uint32_t rc = ZXDH_OK;
> + uint32_t i = 0;
> + uint32_t row_index = 0;
> + uint32_t col_index = 0;
> + uint32_t temp_data[4] = {0};
> + uint32_t *p_temp_data = NULL;
> + ZXDH_SMMU0_SMMU0_CPU_IND_CMD_T cpu_ind_cmd = {0};
> + ZXDH_MUTEX_T *p_ind_mutex = NULL;
> +
> + rc = zxdh_np_dev_opr_mutex_get(dev_id, ZXDH_DEV_MUTEX_T_SMMU0, &p_ind_mutex);
> + ZXDH_COMM_CHECK_DEV_RC(dev_id, rc, "zxdh_np_dev_opr_mutex_get");
> +
> + rc = zxdh_np_comm_mutex_lock(p_ind_mutex);
> + ZXDH_COMM_CHECK_DEV_RC(dev_id, rc, "zxdh_np_comm_mutex_lock");
> +
> + rc = zxdh_np_se_done_status_check(dev_id, ZXDH_SMMU0_SMMU0_WR_ARB_CPU_RDYR, 0);
> + ZXDH_COMM_CHECK_DEV_RC_UNLOCK(dev_id, rc, "zxdh_np_se_done_status_check", p_ind_mutex);
> +
> + if (rd_clr_mode == ZXDH_RD_MODE_HOLD) {
> + cpu_ind_cmd.cpu_ind_rw = ZXDH_SE_OPR_RD;
> + cpu_ind_cmd.cpu_ind_rd_mode = ZXDH_RD_MODE_HOLD;
> + cpu_ind_cmd.cpu_req_mode = ZXDH_ERAM128_OPR_128b;
> +
> + switch (rd_mode) {
> + case ZXDH_ERAM128_OPR_128b:
> + {
> + if ((0xFFFFFFFF - (base_addr)) < (index)) {
> + rc = zxdh_np_comm_mutex_unlock(p_ind_mutex);
> + ZXDH_COMM_CHECK_DEV_RC(dev_id, rc, "zxdh_np_comm_mutex_unlock");
> + PMD_DRV_LOG(ERR, "%s : index 0x%x is invalid!", __func__, index);
> + return ZXDH_PAR_CHK_INVALID_INDEX;
> + }
> + if (base_addr + index > ZXDH_SE_SMMU0_ERAM_ADDR_NUM_TOTAL - 1) {
> + PMD_DRV_LOG(ERR, "%s : index out of range !", __func__);
> + rc = zxdh_np_comm_mutex_unlock(p_ind_mutex);
> + ZXDH_COMM_CHECK_DEV_RC(dev_id, rc, "zxdh_np_comm_mutex_unlock");
> + return ZXDH_ERR;
> + }
The error paths here are a bit of a mess.
Do you really have to check return value of mutex_unlock if already have an error?
prev parent reply other threads:[~2025-02-10 18:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 1:44 [PATCH v1 01/14] net/zxdh: add network processor registers ops Bingbin Chen
2025-02-10 1:46 ` [PATCH v1 02/14] net/zxdh: support compatibility check Bingbin Chen
2025-02-10 17:25 ` Stephen Hemminger
2025-02-10 1:47 ` [PATCH v1 03/14] net/zxdh: add agent channel Bingbin Chen
2025-02-10 17:28 ` Stephen Hemminger
2025-02-10 17:30 ` Stephen Hemminger
2025-02-10 17:31 ` Stephen Hemminger
2025-02-10 18:23 ` Stephen Hemminger
2025-02-10 1:47 ` [PATCH v1 04/14] net/zxdh: modify dtb queue ops Bingbin Chen
2025-02-10 17:31 ` Stephen Hemminger
2025-02-10 1:48 ` [PATCH v1 05/14] net/zxdh: add tables dump address ops Bingbin Chen
2025-02-10 17:33 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 06/14] net/zxdh: add eram tables ops Bingbin Chen
2025-02-10 1:50 ` [PATCH v1 07/14] net/zxdh: get flow tables resources Bingbin Chen
2025-02-10 17:35 ` Stephen Hemminger
2025-02-10 17:35 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 08/14] net/zxdh: support hash resources configuration Bingbin Chen
2025-02-10 17:36 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 09/14] net/zxdh: implement tables initialization Bingbin Chen
2025-02-10 17:40 ` Stephen Hemminger
2025-02-10 17:43 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 10/14] net/zxdh: support hash tables write and delete ops Bingbin Chen
2025-02-10 17:45 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 11/14] net/zxdh: get hash table entry result Bingbin Chen
2025-02-10 17:46 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 12/14] net/zxdh: delete all hash entries Bingbin Chen
2025-02-10 17:47 ` Stephen Hemminger
2025-02-10 1:50 ` [PATCH v1 13/14] net/zxdh: add acl tables ops Bingbin Chen
2025-02-10 1:50 ` [PATCH v1 14/14] net/zxdh: clean stat values Bingbin Chen
2025-02-10 17:50 ` Stephen Hemminger
2025-02-10 17:50 ` Stephen Hemminger
2025-02-10 18:19 ` Stephen Hemminger [this message]
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=20250210101939.4bc47c61@hermes.local \
--to=stephen@networkplumber.org \
--cc=chen.bingbin@zte.com.cn \
--cc=dev@dpdk.org \
/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).