spi: spi-qpic-snand: return early on error from qcom_spi_io_op()

When submitting of the descriptors fails, it is quite likely that
the register read buffer contains no valid data. Even if the data
is valid the function returns with an error code anyway.

Change the code to return early if qcom_submit_descs() fails to
avoid superfluously copying possibly invalid data.

Also change the return statement at the end of the function to use
zero value to indicate success obviusly.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250515-qpic-snand-early-error-v1-1-681c87611213@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Gabor Juhos 2025-05-15 22:13:29 +02:00 committed by Mark Brown
parent e7f3d11567
commit 72b17676d3
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1383,8 +1383,10 @@ static int qcom_spi_io_op(struct qcom_nand_controller *snandc, const struct spi_
}
ret = qcom_submit_descs(snandc);
if (ret)
if (ret) {
dev_err(snandc->dev, "failure in submitting descriptor for:%d\n", opcode);
return ret;
}
if (copy) {
qcom_nandc_dev_to_mem(snandc, true);
@ -1398,7 +1400,7 @@ static int qcom_spi_io_op(struct qcom_nand_controller *snandc, const struct spi_
memcpy(op->data.buf.in, &val, snandc->buf_count);
}
return ret;
return 0;
}
static bool qcom_spi_is_page_op(const struct spi_mem_op *op)