diff options
| -rw-r--r-- | drivers/char/virtio_console.c | 37 | ||||
| -rw-r--r-- | drivers/virtio/virtio.c | 6 | ||||
| -rw-r--r-- | drivers/virtio/virtio_ring.c | 3 | ||||
| -rw-r--r-- | include/linux/module.h | 2 |
4 files changed, 13 insertions, 35 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 6c1b676643a..896a2ced1d2 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1547,31 +1547,16 @@ static int init_vqs(struct ports_device *portdev) | |||
| 1547 | nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2; | 1547 | nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2; |
| 1548 | 1548 | ||
| 1549 | vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL); | 1549 | vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL); |
| 1550 | if (!vqs) { | ||
| 1551 | err = -ENOMEM; | ||
| 1552 | goto fail; | ||
| 1553 | } | ||
| 1554 | io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL); | 1550 | io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL); |
| 1555 | if (!io_callbacks) { | ||
| 1556 | err = -ENOMEM; | ||
| 1557 | goto free_vqs; | ||
| 1558 | } | ||
| 1559 | io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL); | 1551 | io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL); |
| 1560 | if (!io_names) { | ||
| 1561 | err = -ENOMEM; | ||
| 1562 | goto free_callbacks; | ||
| 1563 | } | ||
| 1564 | portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), | 1552 | portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), |
| 1565 | GFP_KERNEL); | 1553 | GFP_KERNEL); |
| 1566 | if (!portdev->in_vqs) { | ||
| 1567 | err = -ENOMEM; | ||
| 1568 | goto free_names; | ||
| 1569 | } | ||
| 1570 | portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), | 1554 | portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), |
| 1571 | GFP_KERNEL); | 1555 | GFP_KERNEL); |
| 1572 | if (!portdev->out_vqs) { | 1556 | if (!vqs || !io_callbacks || !io_names || !portdev->in_vqs || |
| 1557 | !portdev->out_vqs) { | ||
| 1573 | err = -ENOMEM; | 1558 | err = -ENOMEM; |
| 1574 | goto free_invqs; | 1559 | goto free; |
| 1575 | } | 1560 | } |
| 1576 | 1561 | ||
| 1577 | /* | 1562 | /* |
| @@ -1605,7 +1590,7 @@ static int init_vqs(struct ports_device *portdev) | |||
| 1605 | io_callbacks, | 1590 | io_callbacks, |
| 1606 | (const char **)io_names); | 1591 | (const char **)io_names); |
| 1607 | if (err) | 1592 | if (err) |
| 1608 | goto free_outvqs; | 1593 | goto free; |
| 1609 | 1594 | ||
| 1610 | j = 0; | 1595 | j = 0; |
| 1611 | portdev->in_vqs[0] = vqs[0]; | 1596 | portdev->in_vqs[0] = vqs[0]; |
| @@ -1621,23 +1606,19 @@ static int init_vqs(struct ports_device *portdev) | |||
| 1621 | portdev->out_vqs[i] = vqs[j + 1]; | 1606 | portdev->out_vqs[i] = vqs[j + 1]; |
| 1622 | } | 1607 | } |
| 1623 | } | 1608 | } |
| 1624 | kfree(io_callbacks); | ||
| 1625 | kfree(io_names); | 1609 | kfree(io_names); |
| 1610 | kfree(io_callbacks); | ||
| 1626 | kfree(vqs); | 1611 | kfree(vqs); |
| 1627 | 1612 | ||
| 1628 | return 0; | 1613 | return 0; |
| 1629 | 1614 | ||
| 1630 | free_names: | 1615 | free: |
| 1631 | kfree(io_names); | ||
| 1632 | free_callbacks: | ||
| 1633 | kfree(io_callbacks); | ||
| 1634 | free_outvqs: | ||
| 1635 | kfree(portdev->out_vqs); | 1616 | kfree(portdev->out_vqs); |
| 1636 | free_invqs: | ||
| 1637 | kfree(portdev->in_vqs); | 1617 | kfree(portdev->in_vqs); |
| 1638 | free_vqs: | 1618 | kfree(io_names); |
| 1619 | kfree(io_callbacks); | ||
| 1639 | kfree(vqs); | 1620 | kfree(vqs); |
| 1640 | fail: | 1621 | |
| 1641 | return err; | 1622 | return err; |
| 1642 | } | 1623 | } |
| 1643 | 1624 | ||
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 3a43ebf83a4..efb35aa8309 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
| @@ -9,19 +9,19 @@ static ssize_t device_show(struct device *_d, | |||
| 9 | struct device_attribute *attr, char *buf) | 9 | struct device_attribute *attr, char *buf) |
| 10 | { | 10 | { |
| 11 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 11 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); |
| 12 | return sprintf(buf, "%hu", dev->id.device); | 12 | return sprintf(buf, "0x%04x\n", dev->id.device); |
| 13 | } | 13 | } |
| 14 | static ssize_t vendor_show(struct device *_d, | 14 | static ssize_t vendor_show(struct device *_d, |
| 15 | struct device_attribute *attr, char *buf) | 15 | struct device_attribute *attr, char *buf) |
| 16 | { | 16 | { |
| 17 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 17 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); |
| 18 | return sprintf(buf, "%hu", dev->id.vendor); | 18 | return sprintf(buf, "0x%04x\n", dev->id.vendor); |
| 19 | } | 19 | } |
| 20 | static ssize_t status_show(struct device *_d, | 20 | static ssize_t status_show(struct device *_d, |
| 21 | struct device_attribute *attr, char *buf) | 21 | struct device_attribute *attr, char *buf) |
| 22 | { | 22 | { |
| 23 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 23 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); |
| 24 | return sprintf(buf, "0x%08x", dev->config->get_status(dev)); | 24 | return sprintf(buf, "0x%08x\n", dev->config->get_status(dev)); |
| 25 | } | 25 | } |
| 26 | static ssize_t modalias_show(struct device *_d, | 26 | static ssize_t modalias_show(struct device *_d, |
| 27 | struct device_attribute *attr, char *buf) | 27 | struct device_attribute *attr, char *buf) |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1475ed6b575..cc2f73e0347 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -230,9 +230,6 @@ add_head: | |||
| 230 | pr_debug("Added buffer head %i to %p\n", head, vq); | 230 | pr_debug("Added buffer head %i to %p\n", head, vq); |
| 231 | END_USE(vq); | 231 | END_USE(vq); |
| 232 | 232 | ||
| 233 | /* If we're indirect, we can fit many (assuming not OOM). */ | ||
| 234 | if (vq->indirect) | ||
| 235 | return vq->num_free ? vq->vring.num : 0; | ||
| 236 | return vq->num_free; | 233 | return vq->num_free; |
| 237 | } | 234 | } |
| 238 | EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); | 235 | EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); |
diff --git a/include/linux/module.h b/include/linux/module.h index b29e7458b96..7575bbbdf2a 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -517,7 +517,7 @@ static inline void __module_get(struct module *module) | |||
| 517 | #define symbol_put_addr(p) do { } while(0) | 517 | #define symbol_put_addr(p) do { } while(0) |
| 518 | 518 | ||
| 519 | #endif /* CONFIG_MODULE_UNLOAD */ | 519 | #endif /* CONFIG_MODULE_UNLOAD */ |
| 520 | int use_module(struct module *a, struct module *b); | 520 | int ref_module(struct module *a, struct module *b); |
| 521 | 521 | ||
| 522 | /* This is a #define so the string doesn't get put in every .o file */ | 522 | /* This is a #define so the string doesn't get put in every .o file */ |
| 523 | #define module_name(mod) \ | 523 | #define module_name(mod) \ |
