spi: spi_ll_stm32: Fix transceive() ret value in spi_slave case

In SPI slave case the transceive should return either the negative
errno code in case of error or the number of frames received.
So, now:

 1. the spi_stm32_get_err() routine already checks whether
    the SPI cell got an error and returns -EIO in that case.

 2. the transceive() routine always returns whatever the
    spi_context_wait_for_completion() has returned, which
    is either:
        a. -EIO in case of error
        b. 0 in spi_master ok case
        c. the number of frames received in spi_slave ok case

Signed-off-by: Armando Visconti <armando.visconti@st.com>
diff --git a/drivers/spi/spi_ll_stm32.c b/drivers/spi/spi_ll_stm32.c
index a8e7d00..f327f83 100644
--- a/drivers/spi/spi_ll_stm32.c
+++ b/drivers/spi/spi_ll_stm32.c
@@ -52,7 +52,13 @@
 {
 	u32_t sr = LL_SPI_ReadReg(spi, SR);
 
-	return (int)(sr & SPI_STM32_ERR_MSK);
+	if (sr & SPI_STM32_ERR_MSK) {
+		SYS_LOG_ERR("%s: err=%d", __func__,
+			    sr & SPI_STM32_ERR_MSK);
+		return -EIO;
+	}
+
+	return 0;
 }
 
 static inline u16_t spi_stm32_next_tx(struct spi_stm32_data *data)
@@ -410,15 +416,18 @@
 	} while (!ret && spi_stm32_transfer_ongoing(data));
 
 	spi_stm32_complete(data, spi, ret);
+
+#ifdef CONFIG_SPI_SLAVE
+	if (spi_context_is_slave(&data->ctx) && !ret) {
+		ret = data->ctx.recv_frames;
+	}
+#endif /* CONFIG_SPI_SLAVE */
+
 #endif
 
 	spi_context_release(&data->ctx, ret);
 
-	if (ret) {
-		SYS_LOG_ERR("error mask 0x%x", ret);
-	}
-
-	return ret ? -EIO : 0;
+	return ret;
 }
 
 static int spi_stm32_transceive(struct device *dev,