From 1a6118193cec8790036086708c5fa73fd09ef6c2 Mon Sep 17 00:00:00 2001 From: morris Date: Thu, 30 Mar 2023 11:47:54 +0800 Subject: [PATCH] spi_lcd: don't release bus if acquire failed Closes https://github.com/espressif/esp-idf/issues/10952 --- components/esp_lcd/src/esp_lcd_panel_io_spi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp_lcd/src/esp_lcd_panel_io_spi.c b/components/esp_lcd/src/esp_lcd_panel_io_spi.c index 11d253d994..0044fbac41 100644 --- a/components/esp_lcd/src/esp_lcd_panel_io_spi.c +++ b/components/esp_lcd/src/esp_lcd_panel_io_spi.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -144,7 +144,7 @@ static esp_err_t panel_io_spi_register_event_callbacks(esp_lcd_panel_io_handle_t esp_lcd_panel_io_spi_t *spi_panel_io = __containerof(io, esp_lcd_panel_io_spi_t, base); if (spi_panel_io->on_color_trans_done != NULL) { - ESP_LOGW(TAG, "Callback on_color_trans_done was already set and now it was owerwritten!"); + ESP_LOGW(TAG, "Callback on_color_trans_done was already set and now it was overwritten!"); } spi_panel_io->on_color_trans_done = cbs->on_color_trans_done; @@ -189,7 +189,7 @@ static esp_err_t panel_io_spi_tx_param(esp_lcd_panel_io_t *io, int lcd_cmd, cons esp_lcd_panel_io_spi_t *spi_panel_io = __containerof(io, esp_lcd_panel_io_spi_t, base); bool send_cmd = (lcd_cmd >= 0); - spi_device_acquire_bus(spi_panel_io->spi_dev, portMAX_DELAY); + ESP_RETURN_ON_ERROR(spi_device_acquire_bus(spi_panel_io->spi_dev, portMAX_DELAY), TAG, "acquire spi bus failed"); // before issue a polling transaction, need to wait queued transactions finished size_t num_trans_inflight = spi_panel_io->num_trans_inflight; @@ -249,7 +249,7 @@ static esp_err_t panel_io_spi_rx_param(esp_lcd_panel_io_t *io, int lcd_cmd, void esp_lcd_panel_io_spi_t *spi_panel_io = __containerof(io, esp_lcd_panel_io_spi_t, base); bool send_cmd = (lcd_cmd >= 0); - spi_device_acquire_bus(spi_panel_io->spi_dev, portMAX_DELAY); + ESP_RETURN_ON_ERROR(spi_device_acquire_bus(spi_panel_io->spi_dev, portMAX_DELAY), TAG, "acquire spi bus failed"); // before issue a polling transaction, need to wait queued transactions finished size_t num_trans_inflight = spi_panel_io->num_trans_inflight;