diff --git a/simio/simio.c b/simio/simio.c index 998a7ca..5ba12e7 100644 --- a/simio/simio.c +++ b/simio/simio.c @@ -341,7 +341,7 @@ IO_REQUEST_FUNC(static simio_read_b_device, read_b, uint8_t *) int simio_write_b(address_t addr, uint8_t data) { - if (addr >= 0 && addr < 16) { + if (addr < 16) { sfr_data[addr] = data; return 0; } @@ -351,7 +351,7 @@ int simio_write_b(address_t addr, uint8_t data) int simio_read_b(address_t addr, uint8_t *data) { - if (addr >= 0 && addr < 16) { + if (addr < 16) { *data = sfr_data[addr]; return 0; } @@ -425,7 +425,7 @@ void simio_step(uint16_t status_register, int cycles) uint8_t simio_sfr_get(address_t which) { - if (which < 0 || which > sizeof(sfr_data)) + if (which > sizeof(sfr_data)) return 0; return sfr_data[which]; @@ -433,7 +433,7 @@ uint8_t simio_sfr_get(address_t which) void simio_sfr_modify(address_t which, uint8_t mask, uint8_t bits) { - if (which < 0 || which > sizeof(sfr_data)) + if (which > sizeof(sfr_data)) return; sfr_data[which] = (sfr_data[which] & ~mask) | bits; diff --git a/simio/simio_gpio.c b/simio/simio_gpio.c index 543a2e5..510c7a2 100644 --- a/simio/simio_gpio.c +++ b/simio/simio_gpio.c @@ -146,7 +146,7 @@ static int config_channel(struct gpio *g, char **arg_text) return -1; } - if (which < 0 || which > 7) { + if (which > 7) { printc_err("gpio: invalid pin number: %d\n", which); return -1; } diff --git a/simio/simio_timer.c b/simio/simio_timer.c index a29ac23..bbbbaa1 100644 --- a/simio/simio_timer.c +++ b/simio/simio_timer.c @@ -192,7 +192,7 @@ static int config_channel(struct timer *tr, char **arg_text) return -1; } - if (which < 0 || which > tr->size) { + if (which > tr->size) { printc_err("timer: invalid channel number: %d\n", which); return -1; } diff --git a/simio/simio_tracer.c b/simio/simio_tracer.c index e4540ea..6a30654 100644 --- a/simio/simio_tracer.c +++ b/simio/simio_tracer.c @@ -214,7 +214,7 @@ static int tracer_config(struct simio_device *dev, return -1; } - if (value < 0 || value >= 16) { + if (value >= 16) { printc_err("tracer: trigger: invalid IRQ: %d\n", value); return -1; diff --git a/util/dis.c b/util/dis.c index b18428b..932d54b 100644 --- a/util/dis.c +++ b/util/dis.c @@ -1007,7 +1007,7 @@ int dis_reg_from_name(const char *name) const char *dis_reg_name(msp430_reg_t reg) { - if (reg >= 0 && reg <= 15) + if (reg <= 15) return msp430_reg_names[reg]; return NULL; diff --git a/util/expr.c b/util/expr.c index bdc1fc1..9c0c889 100644 --- a/util/expr.c +++ b/util/expr.c @@ -233,7 +233,6 @@ static int addr_exp_finish(struct addr_exp_state *s, address_t *ret) int expr_eval(const char *text, address_t *addr) { const char *text_save = text; - int last_cc = 1; char token_buf[64]; int token_len = 0; struct addr_exp_state s = {0}; @@ -281,7 +280,6 @@ int expr_eval(const char *text, address_t *addr) if (!*text) break; - last_cc = cc; text++; } diff --git a/util/output_util.c b/util/output_util.c index e042546..485f873 100644 --- a/util/output_util.c +++ b/util/output_util.c @@ -27,7 +27,6 @@ static int format_addr(msp430_amode_t amode, uint16_t addr) { char name[64]; - int numeric = 0; const char *prefix = ""; switch (amode) { @@ -39,7 +38,6 @@ static int format_addr(msp430_amode_t amode, uint16_t addr) case MSP430_AMODE_IMMEDIATE: prefix = "#"; case MSP430_AMODE_INDEXED: - numeric = 1; break; case MSP430_AMODE_ABSOLUTE: