From f74ed8ecd7f67bf36b9532b65eb3df1d4551a36f Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Sat, 22 Feb 2020 11:05:38 +0000 Subject: [PATCH] [ion] Fix error check in the USB stack The return type of the function receiveSomeData needs to be wider so the -1 error value could fit. Fixes #1335 --- ion/src/device/shared/usb/stack/endpoint0.cpp | 2 +- ion/src/device/shared/usb/stack/endpoint0.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ion/src/device/shared/usb/stack/endpoint0.cpp b/ion/src/device/shared/usb/stack/endpoint0.cpp index 14478a086..4e1d4e980 100644 --- a/ion/src/device/shared/usb/stack/endpoint0.cpp +++ b/ion/src/device/shared/usb/stack/endpoint0.cpp @@ -259,7 +259,7 @@ void Endpoint0::clearForOutTransactions(uint16_t wLength) { setOutNAK(false); } -uint16_t Endpoint0::receiveSomeData() { +int Endpoint0::receiveSomeData() { // If it is the first chunk of data to be received, m_transferBufferLength is 0. uint16_t packetSize = MIN(k_maxPacketSize, m_request.wLength() - m_transferBufferLength); uint16_t sizeOfPacketRead = readPacket(m_largeBuffer + m_transferBufferLength, packetSize); diff --git a/ion/src/device/shared/usb/stack/endpoint0.h b/ion/src/device/shared/usb/stack/endpoint0.h index ca6809bfb..a0ef41686 100644 --- a/ion/src/device/shared/usb/stack/endpoint0.h +++ b/ion/src/device/shared/usb/stack/endpoint0.h @@ -57,7 +57,7 @@ public: void clearForOutTransactions(uint16_t wLength); private: - uint16_t receiveSomeData(); + int receiveSomeData(); uint16_t readPacket(void * buffer, uint16_t length); uint16_t writePacket(const void * buffer, uint16_t length);