From 0827b6982bb67136c7a3c1bd1d4b0ba1924efbb7 Mon Sep 17 00:00:00 2001 From: Amir Hammad Date: Mon, 6 Apr 2015 16:01:20 +0200 Subject: LLD: stm32f4: change type of i to signed integer this was causing infinite loop, when size of the data was not multiple of 4. Signed-off-by: Amir Hammad --- src/usbh_lld_stm32f4.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/usbh_lld_stm32f4.c b/src/usbh_lld_stm32f4.c index ad14d2e..4ee9d77 100644 --- a/src/usbh_lld_stm32f4.c +++ b/src/usbh_lld_stm32f4.c @@ -341,15 +341,16 @@ static void stm32f4_usbh_write(void *drvdata, const usbh_packet_t *packet) volatile uint32_t *fifo = &REBASE_CH(OTG_FIFO, channel) + RX_FIFO_SIZE; const uint32_t * buf32 = packet->data; - uint32_t i; + int i; for(i = packet->datalen; i > 0; i-=4) { *fifo++ = *buf32++; } + } else { volatile uint32_t *fifo = &REBASE_CH(OTG_FIFO, channel) + RX_FIFO_SIZE + TX_NP_FIFO_SIZE; const uint32_t * buf32 = packet->data; - uint32_t i; + int i; for(i = packet->datalen; i > 0; i-=4) { *fifo++ = *buf32++; } -- cgit