cc2520: Ignore received bogus packets silently

Instead of return 0 if there is an error, return
a value < 0 so that caller caller of cc2520_read()
can reject packet right away.

Change-Id: I99808db6aa692cf4415f630193d35e51d4bc3144
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-02-09 10:48:04 +02:00 committed by Gerrit Code Review
commit 44f990144b

View file

@ -841,7 +841,7 @@ static int cc2520_read(void *buf, unsigned short bufsize)
} }
if (!cc2520_pending_packet()) { if (!cc2520_pending_packet()) {
return 0; return -EAGAIN;
} }
cc2520_packets_read++; cc2520_packets_read++;
@ -893,7 +893,7 @@ error:
print_errors(); print_errors();
flushrx(); flushrx();
return 0; return -EINVAL;
} }
static void read_packet(void) static void read_packet(void)