X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=trinked.git;a=blobdiff_plain;f=trinket.c;h=8f2cdc96ef8d95e98ea06581708475d090e18d4a;hp=ba5fdb3924bf8baeabf7bed744b0b6e7e7c01179;hb=8cbe60be9b46ed1bd7aa695ed1be732524994d7d;hpb=dc0de4715bbad873df3bdf0b7ed5e69930465458 diff --git a/trinket.c b/trinket.c index ba5fdb3..8f2cdc9 100644 --- a/trinket.c +++ b/trinket.c @@ -7,10 +7,10 @@ * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -105,6 +105,7 @@ dumpBuf(char *msg, uint8_t *buf, int len) { TrinketErrorCode trinketOpen() { + TrinketErrorCode r; #ifndef NDEBUG int i; @@ -119,7 +120,9 @@ trinketOpen() { return ERR_ERROR; } - return trinketPing(); + if ((r = trinketPing()) != ERR_OK) + trinketClose(); + return r; } void