Skip to content

Commit 72b1767

Browse files
juhosgbroonie
authored andcommitted
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>
1 parent e7f3d11 commit 72b1767

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/spi/spi-qpic-snand.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,10 @@ static int qcom_spi_io_op(struct qcom_nand_controller *snandc, const struct spi_
13831383
}
13841384

13851385
ret = qcom_submit_descs(snandc);
1386-
if (ret)
1386+
if (ret) {
13871387
dev_err(snandc->dev, "failure in submitting descriptor for:%d\n", opcode);
1388+
return ret;
1389+
}
13881390

13891391
if (copy) {
13901392
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_
13981400
memcpy(op->data.buf.in, &val, snandc->buf_count);
13991401
}
14001402

1401-
return ret;
1403+
return 0;
14021404
}
14031405

14041406
static bool qcom_spi_is_page_op(const struct spi_mem_op *op)

0 commit comments

Comments
 (0)