Merge branch 'bugfix/usj_wrong_return_value_v5.4' into 'release/v5.4'

fix(usb_serial_jtag): wrong return value in usb_serial_jtag_write_bytes (v5.4)

See merge request espressif/esp-idf!37969
This commit is contained in:
morris
2025-03-31 16:38:22 +08:00

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -264,9 +264,8 @@ int usb_serial_jtag_read_bytes(void* buf, uint32_t length, TickType_t ticks_to_w
int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_to_wait) int usb_serial_jtag_write_bytes(const void* src, size_t size, TickType_t ticks_to_wait)
{ {
ESP_RETURN_ON_FALSE(size != 0, ESP_ERR_INVALID_ARG, USB_SERIAL_JTAG_TAG, "size should be larger than 0"); ESP_RETURN_ON_FALSE(src && size, 0, USB_SERIAL_JTAG_TAG, "invalid buffer or size");
ESP_RETURN_ON_FALSE(src != NULL, ESP_ERR_INVALID_ARG, USB_SERIAL_JTAG_TAG, "Invalid buffer pointer."); ESP_RETURN_ON_FALSE(p_usb_serial_jtag_obj != NULL, 0, USB_SERIAL_JTAG_TAG, "driver is not initialized yet");
ESP_RETURN_ON_FALSE(p_usb_serial_jtag_obj != NULL, ESP_ERR_INVALID_ARG, USB_SERIAL_JTAG_TAG, "The driver hasn't been initialized");
//This will block when something else is waiting in wait_tx_done, making sure we don't add data to the ringbuffer. //This will block when something else is waiting in wait_tx_done, making sure we don't add data to the ringbuffer.
//Note that the ringbuffer itself is thread-safe, so this is only needed to handle wait_tx_done. //Note that the ringbuffer itself is thread-safe, so this is only needed to handle wait_tx_done.