In _spi_get_bus_and_cs the check for stacked parallel support needing
multiple chip select support does a direct return on error. Instead it
should set the error code in ret and then use the unwind goto.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <[email protected]>
---
 drivers/spi/spi-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 
d6049753740b0637880958feb48e4f523e9c2927..49b584c648d6ffb273f9d5c3f3b773799d26a1fe
 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -449,7 +449,8 @@ int _spi_get_bus_and_cs(int busnum, int cs, int speed, int 
mode,
 #if CONFIG_IS_ENABLED(SPI_STACKED_PARALLEL)
        if ((dev_read_bool(dev, "parallel-memories")) && !slave->multi_cs_cap) {
                dev_err(dev, "controller doesn't support multi CS\n");
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err;
        }
 #endif
        /*

---
base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca
change-id: 20250813-spi_uclass-9a13292c05f2

Best regards,
-- 
Andrew Goodbody <[email protected]>

Reply via email to