diff --git a/boards/avsextrem/drivers/avsextrem-smb380.c b/boards/avsextrem/drivers/avsextrem-smb380.c index 1803b8c686..2a8e20ef7e 100644 --- a/boards/avsextrem/drivers/avsextrem-smb380.c +++ b/boards/avsextrem/drivers/avsextrem-smb380.c @@ -794,15 +794,13 @@ int16_t SMB380_getBandWidthAbs(void) void SMB380_softReset(void) { - unsigned char ur; unsigned long cpsr = disableIRQ(); SMB380_Prepare(); SMB380_ssp_write(SMB380_CONTROL1, SMB380_CONTROL1_SOFT_RESET_MASK, SMB380_WRITE_REGISTER); - ur = ((unsigned char)SMB380_ssp_read()) & SMB380_CONTROL1_SOFT_RESET_MASK; + SMB380_ssp_read(); SMB380_Unprepare(); restoreIRQ(cpsr); - ur = ur >> 1; } void SMB380_setCustomerReg(unsigned char data) diff --git a/boards/redbee-econotag/tools/ftditools/bbmc.c b/boards/redbee-econotag/tools/ftditools/bbmc.c index f0c7e0b032..55713febd4 100644 --- a/boards/redbee-econotag/tools/ftditools/bbmc.c +++ b/boards/redbee-econotag/tools/ftditools/bbmc.c @@ -473,6 +473,8 @@ int print_and_prompt(struct ftdi_device_list *devlist) size_t last = strlen(input) - 1; if (input[last] == '\n') { + /* cppcheck: input is accessed later via *s */ + /* cppcheck-suppress unreadVariable */ input[last] = '\0'; } @@ -534,7 +536,6 @@ void erase(struct ftdi_context *ftdic, const struct layout *l) int bb_mpsee(struct ftdi_context *ftdic, uint16_t dir, uint16_t val) { uint8_t buf[3]; - int ret; /* command "set data bits low byte" */ buf[0] = 0x80; @@ -559,7 +560,7 @@ int bb_mpsee(struct ftdi_context *ftdic, uint16_t dir, uint16_t val) fprintf(stderr, "write %x %x %x\n", buf[0], buf[1], buf[2]); #endif - if ((ret = (ftdi_write_data(ftdic, buf, 3))) < 0) { + if ((ftdi_write_data(ftdic, buf, 3)) < 0) { perror("ft2232_write error"); fprintf(stderr, "ft2232_write command %x\n", buf[0]); return EXIT_FAILURE; diff --git a/cpu/atmega2560/periph/uart.c b/cpu/atmega2560/periph/uart.c index ae08130287..d570ca8fd8 100644 --- a/cpu/atmega2560/periph/uart.c +++ b/cpu/atmega2560/periph/uart.c @@ -27,6 +27,7 @@ #include "periph/uart.h" #include "periph_conf.h" +#if UART_0_EN || UART_1_EN || UART2_EN || UART_3_EN /** * @brief Each UART device has to store two callbacks. @@ -315,3 +316,4 @@ ISR(USART2_RX_vect, ISR_BLOCK) } } #endif /* UART_3_EN */ +#endif /* UART_0_EN || UART_1_EN |UART_2_EN| UART3 */ diff --git a/cpu/mc1322x/maca/maca.c b/cpu/mc1322x/maca/maca.c index 5af259028a..758204a3d1 100644 --- a/cpu/mc1322x/maca/maca.c +++ b/cpu/mc1322x/maca/maca.c @@ -1016,7 +1016,7 @@ uint32_t _maca_init_from_flash ( uint32_t addr ) { length = buffer[1] & 0x0000ffff; while ( i < ( length-4 ) ) { - err = nvm_read ( g_nvm_internal_interface_c, type, ( uint8_t * ) buffer, addr+i, 32 ); + nvm_read ( g_nvm_internal_interface_c, type, ( uint8_t * ) buffer, addr+i, 32 ); i += 4 * _exec_init_entry ( buffer, _ram_values ); } } diff --git a/cpu/nrf51822/periph/uart.c b/cpu/nrf51822/periph/uart.c index 853a4e509a..af86f7bcc6 100644 --- a/cpu/nrf51822/periph/uart.c +++ b/cpu/nrf51822/periph/uart.c @@ -30,7 +30,7 @@ #include "board.h" /* guard file in case no UART device was specified */ -#if UART_NUMOF +#if UART_0_EN /** * @brief Each UART device has to store two callbacks. @@ -241,4 +241,4 @@ void isr_uart0(void) } } -#endif /* UART_NUMOF */ +#endif /* UART_0_EN */ diff --git a/cpu/stm32f1/periph/uart.c b/cpu/stm32f1/periph/uart.c index a63ab8d65f..e995af6242 100644 --- a/cpu/stm32f1/periph/uart.c +++ b/cpu/stm32f1/periph/uart.c @@ -305,3 +305,4 @@ static inline void irq_handler(uint8_t uartnum, USART_TypeDef *dev) thread_yield(); } } +#endif /* UART_0_EN || UART_1_EN */ diff --git a/examples/rpl_udp/helper.c b/examples/rpl_udp/helper.c index 475932a019..87d867b002 100644 --- a/examples/rpl_udp/helper.c +++ b/examples/rpl_udp/helper.c @@ -136,6 +136,8 @@ void rpl_udp_ignore(int argc, char **argv) tcmd.data = &a; if (argc == 2) { + /* cppcheck: a is actually read via tcmd.data */ + /* cppcheck-suppress unreadVariable */ a = atoi(argv[1]); printf("sending to transceiver (%" PRIkernel_pid "): %u\n", transceiver_pid, (*(uint8_t *)tcmd.data)); msg_send(&mesg, transceiver_pid); diff --git a/sys/net/network_layer/sixlowpan/icmp.c b/sys/net/network_layer/sixlowpan/icmp.c index 5889d8045f..1490f35cb9 100644 --- a/sys/net/network_layer/sixlowpan/icmp.c +++ b/sys/net/network_layer/sixlowpan/icmp.c @@ -1518,10 +1518,9 @@ ndp_neighbor_cache_t *ndp_get_ll_address(ipv6_addr_t *ipaddr) int ndp_addr_is_on_link(ipv6_addr_t *dest_addr) { - ndp_neighbor_cache_t *nce; int if_id = -1; - if ((nce = ndp_neighbor_cache_search(dest_addr))) { + if ((ndp_neighbor_cache_search(dest_addr))) { #ifdef DEBUG_ENABLED char addr_str[IPV6_MAX_ADDR_STR_LEN]; DEBUG("INFO: %s is in nbr cache\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, dest_addr)); diff --git a/sys/net/network_layer/sixlowpan/ip.c b/sys/net/network_layer/sixlowpan/ip.c index a61a1d1d5f..060b19462c 100644 --- a/sys/net/network_layer/sixlowpan/ip.c +++ b/sys/net/network_layer/sixlowpan/ip.c @@ -680,7 +680,6 @@ void ipv6_net_if_get_best_src_addr(ipv6_addr_t *src, const ipv6_addr_t *dest) uint8_t bmatch = 0; uint8_t tmp = ipv6_get_addr_match(dest, addr->addr_data); if (tmp >= bmatch) { - bmatch = tmp; tmp_addr = addr; } } diff --git a/sys/net/transport_layer/tcp/tcp.c b/sys/net/transport_layer/tcp/tcp.c index 65b0bc2e3f..e5b8c38aaa 100644 --- a/sys/net/transport_layer/tcp/tcp.c +++ b/sys/net/transport_layer/tcp/tcp.c @@ -683,9 +683,7 @@ void *tcp_packet_handler(void *arg) update_tcp_hc_context(true, tcp_socket, tcp_header); #endif /* Remove reserved bits from tcp flags field */ - uint8_t tcp_flags = tcp_header->reserved_flags; - - switch (tcp_flags) { + switch (tcp_header->reserved_flags) { case TCP_ACK: { /* only ACK Bit set */ uint8_t tcp_payload_len = NTOHS(ipv6_header->length) - TCP_HDR_LEN; diff --git a/sys/transceiver/transceiver.c b/sys/transceiver/transceiver.c index 1c80dd761c..38bede760c 100644 --- a/sys/transceiver/transceiver.c +++ b/sys/transceiver/transceiver.c @@ -811,6 +811,8 @@ static int8_t send_packet(transceiver_type_t t, void *pkt) */ static int32_t set_channel(transceiver_type_t t, void *channel) { + /* cppcheck: c is read depending on enabled modules */ + /* cppcheck-suppress unreadVariable */ uint8_t c = *((uint8_t *)channel); switch (t) { @@ -1030,6 +1032,8 @@ static radio_address_t get_address(transceiver_type_t t) */ static radio_address_t set_address(transceiver_type_t t, void *address) { + /* cppcheck: addr is read depending on enabled modules */ + /* cppcheck-suppress unreadVariable */ radio_address_t addr = *((radio_address_t *)address); switch (t) {