Kill "unsigned op 0" comparisons

- simio/simio.c, simio/simio_gpio.c, simio_timer.c, simio_tracer.c, util/dis.c

Kill unused variables

 - util/expr.c, util/output_util.c
This commit is contained in:
Tamas TEVESZ 2011-11-12 23:28:49 +01:00 committed by Daniel Beer
parent 89fe9a2fab
commit 2fe1580843
7 changed files with 8 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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