Skip to content

Commit ca1832d

Browse files
committed
minor clean up for fs9p code
1 parent 0d0d4aa commit ca1832d

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

include/filesys/fs9p/fs9p_vfs.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@
1111

1212
static struct __using("filesys/fs9p/fs9p_internal.cc") FS;
1313

14-
// receive 1 byte
15-
static unsigned int zdoGet1()
16-
{
17-
int c;
18-
do {
19-
c = _rxraw();
20-
} while (c < 0);
21-
return c;
22-
}
14+
#define zdoGet1() _rxraw(0)
2315

2416
// receive an unsigned long
2517
static unsigned int zdoGet4()
@@ -48,6 +40,10 @@ static int plain_sendrecv(uint8_t *startbuf, uint8_t *endbuf, int maxlen)
4840
int left;
4941
unsigned flags;
5042

43+
if (len <= 4) {
44+
return -1; // not a valid message
45+
}
46+
5147
__lockio(0);
5248

5349
flags = _getrxtxflags();
@@ -61,9 +57,6 @@ static int plain_sendrecv(uint8_t *startbuf, uint8_t *endbuf, int maxlen)
6157
startbuf[3] = (len>>24) & 0xff;
6258
#endif
6359

64-
if (len <= 4) {
65-
return -1; // not a valid message
66-
}
6760
// loadp2's server looks for magic start sequence of $FF, $01
6861
_txraw(0xff);
6962
_txraw(0x01);

0 commit comments

Comments
 (0)