1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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 <joakim@gebart.se>
This commit is contained in:
Joakim Gebart 2014-09-03 10:28:33 +02:00
parent a12b879027
commit 21fc1bd7a6

View File

@ -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;
}