From e92375e07cf54c2fbac6616e58116c98507ac177 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 31 Oct 2023 10:18:35 -0500 Subject: [PATCH] fix(ti): release lock in all TI-SCI xfer return paths Failing to send a message is often not fatal and we will end up trying to send again. This would fail as some exit paths do not release the secure proxy xfer lock. Release this lock on all return paths. Signed-off-by: Andrew Davis Change-Id: I3939015774f819572dbd26720b2c105fba7574cb --- plat/ti/k3/common/drivers/ti_sci/ti_sci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c index 3f22bfdae..d04d80596 100644 --- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c +++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c @@ -155,14 +155,14 @@ static int ti_sci_do_xfer(struct ti_sci_xfer *xfer) ret = k3_sec_proxy_clear_rx_thread(SP_RESPONSE); if (ret) { ERROR("Could not clear response queue (%d)\n", ret); - return ret; + goto unlock; } /* Send the message */ ret = k3_sec_proxy_send(SP_HIGH_PRIORITY, tx_msg); if (ret) { ERROR("Message sending failed (%d)\n", ret); - return ret; + goto unlock; } /* Get the response if requested */ @@ -170,13 +170,14 @@ static int ti_sci_do_xfer(struct ti_sci_xfer *xfer) ret = ti_sci_get_response(rx_msg, SP_RESPONSE); if (ret != 0U) { ERROR("Failed to get response (%d)\n", ret); - return ret; + goto unlock; } } +unlock: bakery_lock_release(&ti_sci_xfer_lock); - return 0; + return ret; } /**