diff options
author | Cristian Maglie <c.maglie@arduino.cc> | 2015-10-01 12:35:24 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@arduino.cc> | 2015-10-02 11:59:23 +0200 |
commit | bad9b58ce3e3770e12b9053c670b22c95aba8b45 (patch) | |
tree | ca6cb9d6eb6a268eb697b7d5e5598bc933b38933 /cores | |
parent | 10512b3f9b2e30759d08af77960ab0ead539a055 (diff) |
[PUSB] Fixed checks on return values
Diffstat (limited to 'cores')
-rw-r--r-- | cores/arduino/PluggableUSB.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cores/arduino/PluggableUSB.cpp b/cores/arduino/PluggableUSB.cpp index 50fd798..acc6276 100644 --- a/cores/arduino/PluggableUSB.cpp +++ b/cores/arduino/PluggableUSB.cpp @@ -29,19 +29,23 @@ PluggableUSB_ PluggableUSB; int PluggableUSB_::getInterface(uint8_t* interfaceNum) { - int ret = 0; + int sent = 0; PUSBListNode* node; for (node = rootNode; node; node = node->next) { - ret = node->getInterface(interfaceNum); + int res = node->getInterface(interfaceNum); + if (res == -1) + return -1; + sent += res; } - return ret; + return sent; } -int PluggableUSB_::getDescriptor(int8_t t) +int PluggableUSB_::getDescriptor(int8_t type) { PUSBListNode* node; for (node = rootNode; node; node = node->next) { - int ret = node->getDescriptor(t); + int ret = node->getDescriptor(type); + // ret!=0 -> request has been processed if (ret) return ret; } |