Skip to content

Commit ca7899a

Browse files
jdascenzionashif
authored andcommitted
drivers: spi: stm32: Fix forever lock when configure failed
On transceive, if the SPI configure failed, the SPI wasn't release. Signed-off-by: Julien D'ascenzio <[email protected]>
1 parent a9a01d4 commit ca7899a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/spi/spi_ll_stm32.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ static int transceive(const struct device *dev,
613613

614614
ret = spi_stm32_configure(dev, config);
615615
if (ret) {
616-
return ret;
616+
goto end;
617617
}
618618

619619
/* Set buffers info */
@@ -656,6 +656,7 @@ static int transceive(const struct device *dev,
656656

657657
#endif
658658

659+
end:
659660
spi_context_release(&data->ctx, ret);
660661

661662
return ret;
@@ -710,8 +711,8 @@ static int transceive_dma(const struct device *dev,
710711
k_sem_reset(&data->status_sem);
711712

712713
ret = spi_stm32_configure(dev, config);
713-
if (ret != 0) {
714-
return ret;
714+
if (ret) {
715+
goto end;
715716
}
716717

717718
/* Set buffers info */
@@ -777,6 +778,7 @@ static int transceive_dma(const struct device *dev,
777778

778779
spi_stm32_complete(dev, ret);
779780

781+
end:
780782
spi_context_release(&data->ctx, ret);
781783

782784
return ret;

0 commit comments

Comments
 (0)