mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-22 13:03:54 +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:
parent
a12b879027
commit
21fc1bd7a6
@ -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 spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length)
|
||||||
{
|
{
|
||||||
int transfered = 0;
|
int transfered = 0;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (out != NULL) {
|
if (out != NULL) {
|
||||||
DEBUG("out*: %p out: %x length: %x\n", out, *out, length);
|
DEBUG("out*: %p out: %x length: %x\n", out, *out, length);
|
||||||
while (length--) {
|
while (length--) {
|
||||||
ret = spi_transfer_byte(dev, *(out)++, 0);
|
int ret = spi_transfer_byte(dev, *(out)++, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -137,7 +136,7 @@ int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length)
|
|||||||
}
|
}
|
||||||
if (in != NULL) {
|
if (in != NULL) {
|
||||||
while (length--) {
|
while (length--) {
|
||||||
ret = spi_transfer_byte(dev, 0, in++);
|
int ret = spi_transfer_byte(dev, 0, in++);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user