From d39665bad43cf3f0e84496833724ccb3abcd8a5b Mon Sep 17 00:00:00 2001 From: Dmitry Filimonchuk Date: Sun, 19 May 2024 16:00:00 +0300 Subject: [PATCH] #133 fix possible pedantic errors --- src/usbd_stm32f103_devfs.c | 2 +- src/usbd_stm32f105_otgfs.c | 5 +++-- src/usbd_stm32f429_otgfs.c | 5 +++-- src/usbd_stm32f429_otghs.c | 5 +++-- src/usbd_stm32f446_otgfs.c | 4 ++-- src/usbd_stm32f446_otghs.c | 4 ++-- src/usbd_stm32h743_otgfs.c | 4 ++-- src/usbd_stm32l052_devfs.c | 2 +- src/usbd_stm32l100_devfs.c | 2 +- src/usbd_stm32l476_otgfs.c | 4 ++-- 10 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/usbd_stm32f103_devfs.c b/src/usbd_stm32f103_devfs.c index 575d6b0..bd41ad5 100644 --- a/src/usbd_stm32f103_devfs.c +++ b/src/usbd_stm32f103_devfs.c @@ -345,7 +345,7 @@ static void ep_deconfig(uint8_t ep) { } static uint16_t pma_read (uint8_t *buf, uint16_t blen, pma_rec *rx) { - uint16_t tmp; + uint16_t tmp = 0; uint16_t *pma = PMA(rx->addr); uint16_t rxcnt = rx->cnt & 0x03FF; rx->cnt &= ~0x3FF; diff --git a/src/usbd_stm32f105_otgfs.c b/src/usbd_stm32f105_otgfs.c index e3c0f4b..455baf3 100644 --- a/src/usbd_stm32f105_otgfs.c +++ b/src/usbd_stm32f105_otgfs.c @@ -321,7 +321,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; volatile uint32_t *fifo = EPFIFO(0); /* no data in RX FIFO */ if (!(OTG->GINTSTS & USB_OTG_GINTSTS_RXFLVL)) return -1; @@ -416,6 +416,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { case 0x03: /* OUT completed */ case 0x04: /* SETUP completed */ _BST(EPOUT(ep)->DOEPCTL, USB_OTG_DOEPCTL_CNAK | USB_OTG_DOEPCTL_EPENA); + // fall through default: /* pop GRXSTSP */ OTG->GRXSTSP; @@ -436,7 +437,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } } diff --git a/src/usbd_stm32f429_otgfs.c b/src/usbd_stm32f429_otgfs.c index 059a541..5e8d237 100644 --- a/src/usbd_stm32f429_otgfs.c +++ b/src/usbd_stm32f429_otgfs.c @@ -318,7 +318,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; volatile uint32_t *fifo = EPFIFO(0); /* no data in RX FIFO */ if (!(OTG->GINTSTS & USB_OTG_GINTSTS_RXFLVL)) return -1; @@ -413,6 +413,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { case 0x03: /* OUT completed */ case 0x04: /* SETUP completed */ _BST(EPOUT(ep)->DOEPCTL, USB_OTG_DOEPCTL_CNAK | USB_OTG_DOEPCTL_EPENA); + // fall through default: /* pop GRXSTSP */ OTG->GRXSTSP; @@ -433,7 +434,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } } diff --git a/src/usbd_stm32f429_otghs.c b/src/usbd_stm32f429_otghs.c index 996c701..10a48dc 100644 --- a/src/usbd_stm32f429_otghs.c +++ b/src/usbd_stm32f429_otghs.c @@ -320,7 +320,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; volatile uint32_t *fifo = EPFIFO(0); /* no data in RX FIFO */ if (!(OTG->GINTSTS & USB_OTG_GINTSTS_RXFLVL)) return -1; @@ -418,6 +418,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { case 0x03: /* OUT completed */ case 0x04: /* SETUP completed */ _BST(EPOUT(ep)->DOEPCTL, USB_OTG_DOEPCTL_CNAK | USB_OTG_DOEPCTL_EPENA); + // fall through default: /* pop GRXSTSP */ OTG->GRXSTSP; @@ -438,7 +439,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } } diff --git a/src/usbd_stm32f446_otgfs.c b/src/usbd_stm32f446_otgfs.c index ea1d586..d933d58 100644 --- a/src/usbd_stm32f446_otgfs.c +++ b/src/usbd_stm32f446_otgfs.c @@ -309,7 +309,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; ep &= 0x7F; volatile uint32_t *fifo = EPFIFO(0); USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep); @@ -418,7 +418,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } } diff --git a/src/usbd_stm32f446_otghs.c b/src/usbd_stm32f446_otghs.c index 4e4a8b3..102db9d 100644 --- a/src/usbd_stm32f446_otghs.c +++ b/src/usbd_stm32f446_otghs.c @@ -309,7 +309,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; ep &= 0x7F; volatile uint32_t *fifo = EPFIFO(0); USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep); @@ -418,7 +418,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } } diff --git a/src/usbd_stm32h743_otgfs.c b/src/usbd_stm32h743_otgfs.c index 7ea6236..d3494d5 100644 --- a/src/usbd_stm32h743_otgfs.c +++ b/src/usbd_stm32h743_otgfs.c @@ -309,7 +309,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; ep &= 0x7F; volatile uint32_t *fifo = EPFIFO(0); USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep); @@ -418,7 +418,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } } diff --git a/src/usbd_stm32l052_devfs.c b/src/usbd_stm32l052_devfs.c index 6bc65ad..d6004c3 100644 --- a/src/usbd_stm32l052_devfs.c +++ b/src/usbd_stm32l052_devfs.c @@ -283,7 +283,7 @@ static void ep_deconfig(uint8_t ep) { } static uint16_t pma_read (uint8_t *buf, uint16_t blen, pma_rec *rx) { - uint16_t tmp; + uint16_t tmp = 0; uint16_t *pma = (void*)(USB_PMAADDR + rx->addr); uint16_t rxcnt = rx->cnt & 0x03FF; rx->cnt &= ~0x3FF; diff --git a/src/usbd_stm32l100_devfs.c b/src/usbd_stm32l100_devfs.c index 9da29fe..f502476 100644 --- a/src/usbd_stm32l100_devfs.c +++ b/src/usbd_stm32l100_devfs.c @@ -255,7 +255,7 @@ static void ep_deconfig(uint8_t ep) { } static uint16_t pma_read (uint8_t *buf, uint16_t blen, pma_rec *rx) { - uint16_t tmp; + uint16_t tmp = 0; uint16_t *pma = (void*)(USB_PMAADDR + 2 * rx->addr); uint16_t rxcnt = rx->cnt & 0x03FF; rx->cnt &= ~0x3FF; diff --git a/src/usbd_stm32l476_otgfs.c b/src/usbd_stm32l476_otgfs.c index 66294bc..6b0eda7 100644 --- a/src/usbd_stm32l476_otgfs.c +++ b/src/usbd_stm32l476_otgfs.c @@ -342,7 +342,7 @@ static void ep_deconfig(uint8_t ep) { } static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) { - uint32_t len, tmp; + uint32_t len, tmp = 0; ep &= 0x7F; volatile uint32_t *fifo = EPFIFO(0); USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep); @@ -451,7 +451,7 @@ static void evt_poll(usbd_device *dev, usbd_evt_callback callback) { /* no more supported events */ return; } - return callback(dev, evt, ep); + callback(dev, evt, ep); } }