1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

lint: fix unreadVariable warnings

This commit is contained in:
Hinnerk van Bruinehsen 2014-10-16 13:32:36 +02:00
parent 4b68b9e547
commit a5aeaab87b
11 changed files with 18 additions and 14 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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 */

View File

@ -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 );
}
}

View File

@ -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 */

View File

@ -305,3 +305,4 @@ static inline void irq_handler(uint8_t uartnum, USART_TypeDef *dev)
thread_yield();
}
}
#endif /* UART_0_EN || UART_1_EN */

View File

@ -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);

View File

@ -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));

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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) {