Skip to content

Commit 6044a61

Browse files
committed
[PUSB] Fixed checks on return values
1 parent e4b3ff2 commit 6044a61

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

hardware/arduino/avr/cores/arduino/PluggableUSB.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,23 @@ PluggableUSB_ PluggableUSB;
2929

3030
int PluggableUSB_::getInterface(uint8_t* interfaceNum)
3131
{
32-
int ret = 0;
32+
int sent = 0;
3333
PUSBListNode* node;
3434
for (node = rootNode; node; node = node->next) {
35-
ret = node->getInterface(interfaceNum);
35+
int res = node->getInterface(interfaceNum);
36+
if (res == -1)
37+
return -1;
38+
sent += res;
3639
}
37-
return ret;
40+
return sent;
3841
}
3942

40-
int PluggableUSB_::getDescriptor(int8_t t)
43+
int PluggableUSB_::getDescriptor(int8_t type)
4144
{
4245
PUSBListNode* node;
4346
for (node = rootNode; node; node = node->next) {
44-
int ret = node->getDescriptor(t);
47+
int ret = node->getDescriptor(type);
48+
// ret!=0 -> request has been processed
4549
if (ret)
4650
return ret;
4751
}

0 commit comments

Comments
 (0)