Correct bad assignments in various conditions

Reported by dcb314.

This fixes #128, #129, #130, #131, #132, #133.

Change-Id: I284d6dd87fba7c5775bea22d04412d685a2ab027
This commit is contained in:
David van Moolenbroek 2016-06-17 20:06:16 +00:00
parent ee0384891a
commit dc2c582f36
6 changed files with 11 additions and 11 deletions

View File

@ -669,7 +669,7 @@ virtio_blk_probe(int skip)
}
/* Allocate memory for headers and status */
if ((r = virtio_blk_alloc_requests() != OK)) {
if ((r = virtio_blk_alloc_requests()) != OK) {
virtio_free_queues(blk_dev);
virtio_free_device(blk_dev);
return r;

View File

@ -34,7 +34,7 @@ int do_schedctl(struct proc * caller, message * m_ptr)
cpu = m_ptr->m_lsys_krn_schedctl.cpu;
/* Try to schedule the process. */
if((r = sched_proc(p, priority, quantum, cpu, FALSE) != OK))
if((r = sched_proc(p, priority, quantum, cpu, FALSE)) != OK)
return r;
p->p_scheduler = NULL;
} else {

View File

@ -263,7 +263,7 @@ virtio_alloc_queues(struct virtio_device *dev, int num_queues)
memset(dev->queues, 0, num_queues * sizeof(dev->queues[0]));
if ((r = init_phys_queues(dev) != OK)) {
if ((r = init_phys_queues(dev)) != OK) {
printf("%s: Could not initialize queues (%d)\n", dev->name, r);
free(dev->queues);
dev->queues = NULL;
@ -750,7 +750,7 @@ void
virtio_irq_enable(struct virtio_device *dev)
{
int r;
if ((r = sys_irqenable(&dev->irq_hook) != OK))
if ((r = sys_irqenable(&dev->irq_hook)) != OK)
panic("%s Unable to enable IRQ %d", dev->name, r);
}
@ -758,7 +758,7 @@ void
virtio_irq_disable(struct virtio_device *dev)
{
int r;
if ((r = sys_irqdisable(&dev->irq_hook) != OK))
if ((r = sys_irqdisable(&dev->irq_hook)) != OK)
panic("%s: Unable to disable IRQ %d", dev->name, r);
}
@ -790,7 +790,7 @@ static void
virtio_irq_register(struct virtio_device *dev)
{
int r;
if ((r = sys_irqsetpolicy(dev->irq, 0, &dev->irq_hook) != OK))
if ((r = sys_irqsetpolicy(dev->irq, 0, &dev->irq_hook)) != OK)
panic("%s: Unable to register IRQ %d", dev->name, r);
}
@ -798,7 +798,7 @@ static void
virtio_irq_unregister(struct virtio_device *dev)
{
int r;
if ((r = sys_irqrmpolicy(&dev->irq_hook) != OK))
if ((r = sys_irqrmpolicy(&dev->irq_hook)) != OK)
panic("%s: Unable to unregister IRQ %d", dev->name, r);
}

View File

@ -696,7 +696,7 @@ static int nic_op_write(struct socket * sock, struct sock_req * req,
return ret;
}
if ((ret = nic->netif.linkoutput(&nic->netif, pbuf) != ERR_OK)) {
if ((ret = nic->netif.linkoutput(&nic->netif, pbuf)) != ERR_OK) {
debug_print("raw linkoutput failed %d", ret);
ret = EIO;
} else

View File

@ -110,7 +110,7 @@ static int tcp_op_open(struct socket * sock)
return ENOMEM;
debug_tcp_print("new tcp pcb %p\n", pcb);
if ((ret = tcp_fill_new_socket(sock, pcb) != OK))
if ((ret = tcp_fill_new_socket(sock, pcb)) != OK)
tcp_abandon(pcb, 0);
return ret;

View File

@ -349,7 +349,7 @@ void test33c()
if (mkdir("nosearch", 0777) != 0) e(1000);
if ( (i = creat("nosearch/file", 0666)) < 0) e(1001);
if (close(i) < 0) e(1002);
if ( (i = creat("file", 0666) < 0)) e(1003);
if ( (i = creat("file", 0666)) < 0) e(1003);
if (close(i) < 0) e(1004);
if (chmod("nosearch/file", 05777) < 0) e(1005);
if (chmod("file", 05777) < 0) e(1006);
@ -359,7 +359,7 @@ void test33c()
/* Test ToLongName and ToLongPath */
does_truncate = does_fs_truncate();
if (does_truncate) {
if ((fd = creat(ToLongName, 0777)) != 0) e(18);
if ((fd = creat(ToLongName, 0777)) == -1) e(18);
if (close(fd) != 0) e(19);
if (access(ToLongName, F_OK) != 0) e(20);
} else {