Fix comparison of unsigned integers

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2015-11-02 10:18:27 +00:00
parent 52a393a311
commit 2643793255
2 changed files with 5 additions and 4 deletions

View File

@ -249,8 +249,6 @@ int main(int argc, char **argv)
case 'r': case 'r':
num_relocs = atoi(optarg); num_relocs = atoi(optarg);
if (num_relocs < 0)
num_relocs = 0;
break; break;
} }
} }

View File

@ -142,9 +142,12 @@ int gem_interrupts_update(struct gem_interrupts *irqs)
return irqs->error; return irqs->error;
if (irqs->fd < 0) { if (irqs->fd < 0) {
val = interrupts_read(); long long ret;
if (val < 0) ret = interrupts_read();
if (ret < 0)
return irqs->error = ENODEV; return irqs->error = ENODEV;
else
val = ret;
} else { } else {
if (read(irqs->fd, &val, sizeof(val)) < 0) if (read(irqs->fd, &val, sizeof(val)) < 0)
return irqs->error = errno; return irqs->error = errno;