spi: spi-zynqmp-gqspi: unlock on error path in exec_op
Subsystems (3)
PATCH 1/1 spi: spi-zynqmp-gqspi: unlock on error path in exec_op
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 <[email protected]>
--- drivers/spi/spi-zynqmp-gqspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-zynqmp-gqspi.c +4 -2
@@ -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;
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 2 lines · Dan Carpenter
If the allocation fails then we need to drop the
&xqspi->op_lockmutex before returning.
This doesn't apply against current code, please check and resend.
Hi Dan,
Quoted 16 lines · Dan Carpenter
If the allocation fails then we need to drop the
&xqspi->op_lockmutex before returning.Fixes a0f65be6e880 ("spi: spi-zynqmp-gqspi: add mutex locking for exec_op")Signed-off-by Dan Carpenter <[email protected]>--- drivers/spi/spi-zynqmp-gqspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/spi/spi-zynqmp-gqspi.c +0
-0@@ -965,8 +965,10 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,if (op->cmd.opcode) {
drivers/spi/spi-zynqmp-gqspi.c static int zynqmp_qspi_exec_op(struct spi_mem *mem, · line 974
Quoted 10 lines
drivers/spi/spi-zynqmp-gqspi.c +4
-2tmpbuf =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