diff options
Diffstat (limited to 'examples/ezusb.c')
-rw-r--r-- | examples/ezusb.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/examples/ezusb.c b/examples/ezusb.c index ec60b0e..4bed12a 100644 --- a/examples/ezusb.c +++ b/examples/ezusb.c @@ -139,7 +139,11 @@ static int ezusb_write(libusb_device_handle *device, const char *label, else logerror("%s ==> %d\n", label, status); } - return (status < 0) ? -EIO : 0; + if (status < 0) { + errno = EIO; + return -1; + } + return 0; } /* @@ -162,7 +166,11 @@ static int ezusb_read(libusb_device_handle *device, const char *label, else logerror("%s ==> %d\n", label, status); } - return (status < 0) ? -EIO : 0; + if (status < 0) { + errno = EIO; + return -1; + } + return 0; } /* @@ -514,7 +522,8 @@ static int ram_poke(void *context, uint32_t addr, bool external, if (external) { logerror("can't write %u bytes external memory at 0x%08x\n", (unsigned)len, addr); - return -EINVAL; + errno = EINVAL; + return -1; } break; case skip_internal: /* CPU must be running */ @@ -538,7 +547,8 @@ static int ram_poke(void *context, uint32_t addr, bool external, case _undef: default: logerror("bug\n"); - return -EDOM; + errno = EDOM; + return -1; } ctx->total += len; |