From 70b3f824d475ed50093103c8564f3096f5b4a745 Mon Sep 17 00:00:00 2001
From: me-no-dev <hristo@espressif.com>
Date: Mon, 27 May 2024 14:39:19 +0300
Subject: [PATCH] fix(eth): Fix ETH.stop() with IDF SPI

---
 libraries/Ethernet/src/ETH.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp
index 818d594241b..f061cf043d4 100644
--- a/libraries/Ethernet/src/ETH.cpp
+++ b/libraries/Ethernet/src/ETH.cpp
@@ -553,7 +553,7 @@ bool ETHClass::beginSPI(
     buscfg.data7_io_num = -1;
     buscfg.max_transfer_sz = -1;
     ret = spi_bus_initialize(spi_host, &buscfg, SPI_DMA_CH_AUTO);
-    if (ret != ESP_OK) {
+    if (ret != ESP_OK && ret != ESP_ERR_INVALID_STATE) {
       log_e("SPI bus initialize failed: %d", ret);
       return false;
     }