From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mark Brown <broonie@kernel.org>,
Quanyang Wang <quanyang.wang@windriver.com>
Cc: Michal Simek <michal.simek@xilinx.com>,
Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>,
linux-spi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] spi: spi-zynqmp-gqspi: unlock on error path in exec_op
Date: Tue, 13 Apr 2021 13:50:42 +0300 [thread overview]
Message-ID: <YHV3gkc3RFcBZVAK@mwanda> (raw)
If the allocation fails then we need to drop the &xqspi->op_lock mutex
before returning.
Fixes: a0f65be6e880 ("spi: spi-zynqmp-gqspi: add mutex locking for exec_op")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/spi/spi-zynqmp-gqspi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index 9494da9aea40..d08ca6d5670c 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -965,8 +965,10 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
if (op->cmd.opcode) {
tmpbuf = kzalloc(op->cmd.nbytes, GFP_KERNEL | GFP_DMA);
- if (!tmpbuf)
- return -ENOMEM;
+ if (!tmpbuf) {
+ err = -ENOMEM;
+ goto return_err;
+ }
tmpbuf[0] = op->cmd.opcode;
reinit_completion(&xqspi->data_completion);
xqspi->txbuf = tmpbuf;
--
2.30.2
next reply other threads:[~2021-04-13 10:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 10:50 Dan Carpenter [this message]
2021-04-13 11:35 ` [PATCH] spi: spi-zynqmp-gqspi: unlock on error path in exec_op Mark Brown
2021-04-13 11:44 ` quanyang.wang
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=YHV3gkc3RFcBZVAK@mwanda \
--to=dan.carpenter@oracle.com \
--cc=amit.kumar-mahapatra@xilinx.com \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=quanyang.wang@windriver.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).