From 21fc1bd7a6234d45e92cd251b1824171495fe61c Mon Sep 17 00:00:00 2001 From: Joakim Gebart Date: Wed, 3 Sep 2014 10:28:33 +0200 Subject: [PATCH] cpu/stm32f1: Reduce scope of ret variable in spi_transfer_bytes. Reduced scope to inside the while loop as per comments in RIOT-OS/RIOT#1630 Signed-off-by: Joakim Gebart --- cpu/stm32f1/periph/spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cpu/stm32f1/periph/spi.c b/cpu/stm32f1/periph/spi.c index 5aff1084ab..a7c603ce43 100644 --- a/cpu/stm32f1/periph/spi.c +++ b/cpu/stm32f1/periph/spi.c @@ -123,12 +123,11 @@ int spi_transfer_byte(spi_t dev, char out, char *in) int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length) { int transfered = 0; - int ret = 0; if (out != NULL) { DEBUG("out*: %p out: %x length: %x\n", out, *out, length); while (length--) { - ret = spi_transfer_byte(dev, *(out)++, 0); + int ret = spi_transfer_byte(dev, *(out)++, 0); if (ret < 0) { return ret; } @@ -137,7 +136,7 @@ int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length) } if (in != NULL) { while (length--) { - ret = spi_transfer_byte(dev, 0, in++); + int ret = spi_transfer_byte(dev, 0, in++); if (ret < 0) { return ret; }