Skip to content

Commit

Permalink
Merge pull request #137 from dmitrystu/work/133-fix-pedantic
Browse files Browse the repository at this point in the history
#133 fix possible pedantic errors
  • Loading branch information
dmitrystu authored May 19, 2024
2 parents e3ca5e6 + d39665b commit 8f59e4a
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/usbd_stm32f103_devfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/usbd_stm32f105_otgfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/usbd_stm32f429_otgfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/usbd_stm32f429_otghs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/usbd_stm32f446_otgfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/usbd_stm32f446_otghs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/usbd_stm32h743_otgfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/usbd_stm32l052_devfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/usbd_stm32l100_devfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/usbd_stm32l476_otgfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 8f59e4a

Please sign in to comment.