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:
parent
ee0384891a
commit
dc2c582f36
@ -669,7 +669,7 @@ virtio_blk_probe(int skip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for headers and status */
|
/* 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_queues(blk_dev);
|
||||||
virtio_free_device(blk_dev);
|
virtio_free_device(blk_dev);
|
||||||
return r;
|
return r;
|
||||||
|
@ -34,7 +34,7 @@ int do_schedctl(struct proc * caller, message * m_ptr)
|
|||||||
cpu = m_ptr->m_lsys_krn_schedctl.cpu;
|
cpu = m_ptr->m_lsys_krn_schedctl.cpu;
|
||||||
|
|
||||||
/* Try to schedule the process. */
|
/* 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;
|
return r;
|
||||||
p->p_scheduler = NULL;
|
p->p_scheduler = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -263,7 +263,7 @@ virtio_alloc_queues(struct virtio_device *dev, int num_queues)
|
|||||||
|
|
||||||
memset(dev->queues, 0, num_queues * sizeof(dev->queues[0]));
|
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);
|
printf("%s: Could not initialize queues (%d)\n", dev->name, r);
|
||||||
free(dev->queues);
|
free(dev->queues);
|
||||||
dev->queues = NULL;
|
dev->queues = NULL;
|
||||||
@ -750,7 +750,7 @@ void
|
|||||||
virtio_irq_enable(struct virtio_device *dev)
|
virtio_irq_enable(struct virtio_device *dev)
|
||||||
{
|
{
|
||||||
int r;
|
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);
|
panic("%s Unable to enable IRQ %d", dev->name, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ void
|
|||||||
virtio_irq_disable(struct virtio_device *dev)
|
virtio_irq_disable(struct virtio_device *dev)
|
||||||
{
|
{
|
||||||
int r;
|
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);
|
panic("%s: Unable to disable IRQ %d", dev->name, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,7 +790,7 @@ static void
|
|||||||
virtio_irq_register(struct virtio_device *dev)
|
virtio_irq_register(struct virtio_device *dev)
|
||||||
{
|
{
|
||||||
int r;
|
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);
|
panic("%s: Unable to register IRQ %d", dev->name, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +798,7 @@ static void
|
|||||||
virtio_irq_unregister(struct virtio_device *dev)
|
virtio_irq_unregister(struct virtio_device *dev)
|
||||||
{
|
{
|
||||||
int r;
|
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);
|
panic("%s: Unable to unregister IRQ %d", dev->name, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ static int nic_op_write(struct socket * sock, struct sock_req * req,
|
|||||||
return ret;
|
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);
|
debug_print("raw linkoutput failed %d", ret);
|
||||||
ret = EIO;
|
ret = EIO;
|
||||||
} else
|
} else
|
||||||
|
@ -110,7 +110,7 @@ static int tcp_op_open(struct socket * sock)
|
|||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
debug_tcp_print("new tcp pcb %p\n", pcb);
|
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);
|
tcp_abandon(pcb, 0);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -349,7 +349,7 @@ void test33c()
|
|||||||
if (mkdir("nosearch", 0777) != 0) e(1000);
|
if (mkdir("nosearch", 0777) != 0) e(1000);
|
||||||
if ( (i = creat("nosearch/file", 0666)) < 0) e(1001);
|
if ( (i = creat("nosearch/file", 0666)) < 0) e(1001);
|
||||||
if (close(i) < 0) e(1002);
|
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 (close(i) < 0) e(1004);
|
||||||
if (chmod("nosearch/file", 05777) < 0) e(1005);
|
if (chmod("nosearch/file", 05777) < 0) e(1005);
|
||||||
if (chmod("file", 05777) < 0) e(1006);
|
if (chmod("file", 05777) < 0) e(1006);
|
||||||
@ -359,7 +359,7 @@ void test33c()
|
|||||||
/* Test ToLongName and ToLongPath */
|
/* Test ToLongName and ToLongPath */
|
||||||
does_truncate = does_fs_truncate();
|
does_truncate = does_fs_truncate();
|
||||||
if (does_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 (close(fd) != 0) e(19);
|
||||||
if (access(ToLongName, F_OK) != 0) e(20);
|
if (access(ToLongName, F_OK) != 0) e(20);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user