Fix MISRA 12.x violations (#667)

* Fix misra 12.x

* typo
This commit is contained in:
Igor 2021-06-18 16:42:49 -07:00 committed by GitHub
parent 6b6262c262
commit 736ff9699f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View File

@ -1,8 +1,7 @@
uint8_t crc_checksum(uint8_t *dat, int len, const uint8_t poly) {
uint8_t crc = 0xFFU;
// FIXME:
// cppcheck-suppress misra-c2012-12.3
int i, j;
int i;
int j;
for (i = len - 1; i >= 0; i--) {
crc ^= dat[i];
for (j = 0; j < 8; j++) {

View File

@ -18,14 +18,13 @@ uint32_t can_rx_errs = 0;
uint32_t can_send_errs = 0;
uint32_t can_fwd_errs = 0;
uint32_t gmlan_send_errs = 0;
// FIXME:
// cppcheck-suppress misra-c2012-12.3
extern int can_live, pending_can_live;
extern int can_live;
extern int pending_can_live;
// must reinit after changing these
// FIXME:
// cppcheck-suppress misra-c2012-12.3
extern int can_loopback, can_silent;
extern int can_loopback;
extern int can_silent;
extern uint32_t can_speed[4];
void can_set_forwarding(int from, int to);
@ -45,9 +44,11 @@ uint32_t ignition_can_cnt = 0U;
#define ALL_CAN_SILENT 0xFF
#define ALL_CAN_LIVE 0
// FIXME:
// cppcheck-suppress misra-c2012-12.3
int can_live = 0, pending_can_live = 0, can_loopback = 0, can_silent = ALL_CAN_SILENT;
int can_live = 0;
int pending_can_live = 0;
int can_loopback = 0;
int can_silent = ALL_CAN_SILENT;
// ********************* instantiate queues *********************
// FIXME:

View File

@ -410,13 +410,11 @@ void USB_WritePacket(const void *src, uint16_t len, uint32_t ep) {
hexdump(src, len);
#endif
uint8_t numpacket = (len + (MAX_RESP_LEN - 1U)) / MAX_RESP_LEN;
uint32_t numpacket = (len + (MAX_RESP_LEN - 1U)) / MAX_RESP_LEN;
uint32_t count32b = 0;
count32b = (len + 3U) / 4U;
// TODO: revisit this
// FIXME:
// cppcheck-suppress misra-c2012-12.2
USBx_INEP(ep)->DIEPTSIZ = ((numpacket << 19) & USB_OTG_DIEPTSIZ_PKTCNT) |
(len & USB_OTG_DIEPTSIZ_XFRSIZ);
USBx_INEP(ep)->DIEPCTL |= (USB_OTG_DIEPCTL_CNAK | USB_OTG_DIEPCTL_EPENA);