DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alvaro Karsz <alvaro.karsz@solid-run.com>
To: dev@dpdk.org
Cc: sachin.saxena@oss.nxp.com, hemant.agrawal@nxp.com,
	Alvaro Karsz <alvaro.karsz@solid-run.com>
Subject: [PATCH v2] bus/fslmc: unlock spinlock in case of timeout
Date: Mon, 26 Dec 2022 09:47:09 +0200	[thread overview]
Message-ID: <20221226074709.2432165-1-alvaro.karsz@solid-run.com> (raw)

Bug in function mc_send_command,
A spinlock is not unlocked in case of timeouts.

Fixes: 79711846f676 ("bus/fslmc: add timeout in MC send command")
Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
--
v2:
	- Fix code indentation.
	- Fix "Fixes: " tag format.
---
 drivers/bus/fslmc/mc/mc_sys.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/mc/mc_sys.c b/drivers/bus/fslmc/mc/mc_sys.c
index ab9a074835..018bd9990e 100644
--- a/drivers/bus/fslmc/mc/mc_sys.c
+++ b/drivers/bus/fslmc/mc/mc_sys.c
@@ -77,8 +77,12 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)
 		total_time = rte_get_timer_cycles() - start_time;
 	} while (status == MC_CMD_STATUS_READY && total_time <= time_to_wait);
 
-	if (status == MC_CMD_STATUS_READY)
+	if (status == MC_CMD_STATUS_READY) {
+		/* --- Call unlock function here in case portal is shared --- */
+		rte_spinlock_unlock(&mc_portal_lock);
+
 		return mc_status_to_error(MC_CMD_STATUS_TIMEOUT);
+	}
 
 	/* Read the response back into the command buffer */
 	mc_read_response(mc_io->regs, cmd);
-- 
2.32.0


             reply	other threads:[~2022-12-26  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-26  7:47 Alvaro Karsz [this message]
2023-01-03  9:51 ` David Marchand
2023-01-03 20:06   ` Alvaro Karsz

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=20221226074709.2432165-1-alvaro.karsz@solid-run.com \
    --to=alvaro.karsz@solid-run.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=sachin.saxena@oss.nxp.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).