From bad9b58ce3e3770e12b9053c670b22c95aba8b45 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 1 Oct 2015 12:35:24 +0200 Subject: [PUSB] Fixed checks on return values --- cores/arduino/PluggableUSB.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'cores/arduino') 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; } -- cgit v1.2.3-18-g5258