git: d101156ec69d - main - intelspi(4): Add missing driver mutex unlock in NO_SLEEP mode

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Mon, 31 Jul 2023 14:30:58 UTC
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=d101156ec69d4c51d626034419a48634d3827f23

commit d101156ec69d4c51d626034419a48634d3827f23
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-07-31 14:30:24 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2023-07-31 14:30:24 +0000

    intelspi(4): Add missing driver mutex unlock in NO_SLEEP mode
    
    Fixes: 1f40866feb21 ("intelspi: add PCI attachment (Lynx/Wildcat/Sunrise Point)")
    
    MFC after:      1 week
---
 sys/dev/intel/spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/intel/spi.c b/sys/dev/intel/spi.c
index 497c2606a1c9..0ac7a3b5e9bb 100644
--- a/sys/dev/intel/spi.c
+++ b/sys/dev/intel/spi.c
@@ -317,8 +317,10 @@ intelspi_transfer(device_t dev, device_t child, struct spi_command *cmd)
 
 	/* If the controller is in use wait until it is available. */
 	while (sc->sc_flags & INTELSPI_BUSY) {
-		if ((cmd->flags & SPI_FLAG_NO_SLEEP) == SPI_FLAG_NO_SLEEP)
+		if ((cmd->flags & SPI_FLAG_NO_SLEEP) == SPI_FLAG_NO_SLEEP) {
+			INTELSPI_UNLOCK(sc);
 			return (EBUSY);
+		}
 		err = mtx_sleep(dev, &sc->sc_mtx, 0, "intelspi", 0);
 		if (err == EINTR) {
 			INTELSPI_UNLOCK(sc);