linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "quanyang.wang" <quanyang.wang@windriver.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Mark Brown <broonie@kernel.org>
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: Re: [PATCH] spi: spi-zynqmp-gqspi: unlock on error path in exec_op
Date: Tue, 13 Apr 2021 19:44:52 +0800	[thread overview]
Message-ID: <3b918af4-2885-7ca9-855e-005798d50761@windriver.com> (raw)
In-Reply-To: <YHV3gkc3RFcBZVAK@mwanda>

Hi Dan,

On 4/13/21 6:50 PM, Dan Carpenter wrote:
> 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;

Thank you for your patch. But similar patch has been applied:

https://www.spinics.net/lists/arm-kernel/msg888807.html

Thanks,

Quanyang


      parent reply	other threads:[~2021-04-13 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 10:50 [PATCH] spi: spi-zynqmp-gqspi: unlock on error path in exec_op Dan Carpenter
2021-04-13 11:35 ` Mark Brown
2021-04-13 11:44 ` quanyang.wang [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=3b918af4-2885-7ca9-855e-005798d50761@windriver.com \
    --to=quanyang.wang@windriver.com \
    --cc=amit.kumar-mahapatra@xilinx.com \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=michal.simek@xilinx.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).