From: David van Moolenbroek Date: Fri, 17 Jun 2016 20:06:16 +0000 (+0000) Subject: Correct bad assignments in various conditions X-Git-Url: http://zhaoyanbai.com/repos/html/static/gitweb.js?a=commitdiff_plain;h=dc2c582f364d955cff3a86092716702b099d2db2;p=minix.git Correct bad assignments in various conditions Reported by dcb314. This fixes #128, #129, #130, #131, #132, #133. Change-Id: I284d6dd87fba7c5775bea22d04412d685a2ab027 --- diff --git a/minix/drivers/storage/virtio_blk/virtio_blk.c b/minix/drivers/storage/virtio_blk/virtio_blk.c index 4e1efc49c..68737bd82 100644 --- a/minix/drivers/storage/virtio_blk/virtio_blk.c +++ b/minix/drivers/storage/virtio_blk/virtio_blk.c @@ -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; diff --git a/minix/kernel/system/do_schedctl.c b/minix/kernel/system/do_schedctl.c index 85c5b9652..dd5af75f0 100644 --- a/minix/kernel/system/do_schedctl.c +++ b/minix/kernel/system/do_schedctl.c @@ -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 { diff --git a/minix/lib/libvirtio/virtio.c b/minix/lib/libvirtio/virtio.c index aa552d6a2..b71c96c7c 100644 --- a/minix/lib/libvirtio/virtio.c +++ b/minix/lib/libvirtio/virtio.c @@ -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); } diff --git a/minix/net/lwip/driver.c b/minix/net/lwip/driver.c index a88f0ab0b..4d6f286f4 100644 --- a/minix/net/lwip/driver.c +++ b/minix/net/lwip/driver.c @@ -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 diff --git a/minix/net/lwip/tcp.c b/minix/net/lwip/tcp.c index adcfb12ce..cebd6df4b 100644 --- a/minix/net/lwip/tcp.c +++ b/minix/net/lwip/tcp.c @@ -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; diff --git a/minix/tests/test33.c b/minix/tests/test33.c index 18b0e9d09..0f96f3979 100644 --- a/minix/tests/test33.c +++ b/minix/tests/test33.c @@ -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 {