diff mbox series

[v5,2/4] spi: Release spi_res after finalizing message

Message ID 20190413182415.38543-3-noralf@tronnes.org (mailing list archive)
State Accepted
Commit c9ba7a16d0f1d2b1e70d47296eca5f612c753825
Headers show
Series Chunk splitting of spi transfers | expand

Commit Message

Noralf Trønnes April 13, 2019, 6:24 p.m. UTC
spi_split_transfers_maxsize() can be used to split a transfer. This
function uses spi_res to lifetime manage the added transfer structures.
So in order to finalize the current message while it contains the split
transfers, spi_res_release() must be called after finalizing.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 05875e63be43..35939ffdeebe 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1162,10 +1162,10 @@  static int spi_transfer_one_message(struct spi_controller *ctlr,
 	if (msg->status && ctlr->handle_err)
 		ctlr->handle_err(ctlr, msg);
 
-	spi_res_release(ctlr, msg);
-
 	spi_finalize_current_message(ctlr);
 
+	spi_res_release(ctlr, msg);
+
 	return ret;
 }