enc28j60: Prevent enc28j60_read() from running before init

This is a precaution in case enc28j60-ip64-driver.c is skipped.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
This commit is contained in:
Benoît Thébaudeau 2015-07-14 23:02:22 +02:00
parent b4c32954a6
commit 6b76ead49c

View file

@ -589,6 +589,10 @@ enc28j60_read(uint8_t *buffer, uint16_t bufsize)
uint8_t status[2]; uint8_t status[2];
uint8_t length[2]; uint8_t length[2];
if(!initialized) {
return -1;
}
err = 0; err = 0;
setregbank(EPKTCNT_BANK); setregbank(EPKTCNT_BANK);