From 8f0af2dac5d62321dc6927904fccd512792478a6 Mon Sep 17 00:00:00 2001 From: "igor.masar" Date: Tue, 25 Mar 2025 23:00:56 +0100 Subject: [PATCH] fix(usb_host): Fix return code and description Changed error code from ESP_ERR_INVALID_STATE to ESP_ERR_NOT_FOUND when the client never opened the device. Updated function documentation to correctly reflect return values. --- components/usb/include/usb/usb_host.h | 2 +- components/usb/usb_host.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/usb/include/usb/usb_host.h b/components/usb/include/usb/usb_host.h index 13a58caee9..23fe3aa364 100644 --- a/components/usb/include/usb/usb_host.h +++ b/components/usb/include/usb/usb_host.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/usb/usb_host.c b/components/usb/usb_host.c index ca70c97197..49ebb0f101 100644 --- a/components/usb/usb_host.c +++ b/components/usb/usb_host.c @@ -886,7 +886,7 @@ esp_err_t usb_host_device_close(usb_host_client_handle_t client_hdl, usb_device_ ESP_ERROR_CHECK(usbh_dev_get_addr(dev_hdl, &dev_addr)); if (!_check_client_opened_device(client_obj, dev_addr)) { // Client never opened this device - ret = ESP_ERR_INVALID_STATE; + ret = ESP_ERR_NOT_FOUND; HOST_EXIT_CRITICAL(); goto exit; }