From 005fa5fea19f406a76eeed50084ae86d38c8de85 Mon Sep 17 00:00:00 2001 From: Sheng-Liang Song Date: Wed, 17 Dec 2014 10:41:52 -0800 Subject: [PATCH] stm32: fixed spi shared_mem_release bug If shared_mem_acquire() failed, we should not call shared_mem_release(). BRANCH=none BUG=chrome-os-partner:34703 TEST="Compiled" Change-Id: I5179f8b75b13451a63eb3209c9156066231aa12d Signed-off-by: Sheng-Liang Song Reviewed-on: https://chromium-review.googlesource.com/236392 Reviewed-by: David Hendricks Reviewed-by: Alexandru Stan Reviewed-by: Randall Spangler --- chip/stm32/spi_master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chip/stm32/spi_master.c b/chip/stm32/spi_master.c index aa37f191d5..ab95ca6594 100644 --- a/chip/stm32/spi_master.c +++ b/chip/stm32/spi_master.c @@ -166,7 +166,7 @@ int spi_transaction_async(const uint8_t *txdata, int txlen, rv = shared_mem_acquire(MAX(txlen, rxlen), &buf); if (rv != EC_SUCCESS) - goto err_free; + return rv; /* Drive SS low */ gpio_set_level(CONFIG_SPI_CS_GPIO, 0);