aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@arduino.cc>2015-10-01 12:35:24 +0200
committerCristian Maglie <c.maglie@arduino.cc>2015-10-02 11:59:23 +0200
commitbad9b58ce3e3770e12b9053c670b22c95aba8b45 (patch)
treeca6cb9d6eb6a268eb697b7d5e5598bc933b38933 /cores
parent10512b3f9b2e30759d08af77960ab0ead539a055 (diff)
[PUSB] Fixed checks on return values
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/PluggableUSB.cpp14
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;
}