diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-04 14:32:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-04 14:32:02 -0500 |
commit | 2391f0b4808e3d5af348324d69f5f45c56a26836 (patch) | |
tree | 752fafc20deffc6e34f02a4558d995b4dee829db | |
parent | 236fa078c622610a5e9df6225e997bd027cbf3c3 (diff) | |
parent | d9e427f6ab8142d6868eb719e6a7851aafea56b6 (diff) |
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio fixes from Michael Tsirkin:
"virtio and qemu bugfixes
A couple of bugfixes that just became ready"
* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
virtio_balloon: fix increment of vb->num_pfns in fill_balloon()
virtio: release virtio index when fail to device_register
fw_cfg: fix driver remove
-rw-r--r-- | drivers/firmware/qemu_fw_cfg.c | 3 | ||||
-rw-r--r-- | drivers/virtio/virtio.c | 2 | ||||
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index 5cfe39f7a45f..deb483064f53 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c | |||
@@ -582,9 +582,10 @@ static int fw_cfg_sysfs_remove(struct platform_device *pdev) | |||
582 | { | 582 | { |
583 | pr_debug("fw_cfg: unloading.\n"); | 583 | pr_debug("fw_cfg: unloading.\n"); |
584 | fw_cfg_sysfs_cache_cleanup(); | 584 | fw_cfg_sysfs_cache_cleanup(); |
585 | sysfs_remove_file(fw_cfg_top_ko, &fw_cfg_rev_attr.attr); | ||
586 | fw_cfg_io_cleanup(); | ||
585 | fw_cfg_kset_unregister_recursive(fw_cfg_fname_kset); | 587 | fw_cfg_kset_unregister_recursive(fw_cfg_fname_kset); |
586 | fw_cfg_kobj_cleanup(fw_cfg_sel_ko); | 588 | fw_cfg_kobj_cleanup(fw_cfg_sel_ko); |
587 | fw_cfg_io_cleanup(); | ||
588 | return 0; | 589 | return 0; |
589 | } | 590 | } |
590 | 591 | ||
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 48230a5e12f2..bf7ff3934d7f 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev) | |||
333 | /* device_register() causes the bus infrastructure to look for a | 333 | /* device_register() causes the bus infrastructure to look for a |
334 | * matching driver. */ | 334 | * matching driver. */ |
335 | err = device_register(&dev->dev); | 335 | err = device_register(&dev->dev); |
336 | if (err) | ||
337 | ida_simple_remove(&virtio_index_ida, dev->index); | ||
336 | out: | 338 | out: |
337 | if (err) | 339 | if (err) |
338 | virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); | 340 | virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED); |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 7960746f7597..a1fb52cb3f0a 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -174,13 +174,12 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num) | |||
174 | while ((page = balloon_page_pop(&pages))) { | 174 | while ((page = balloon_page_pop(&pages))) { |
175 | balloon_page_enqueue(&vb->vb_dev_info, page); | 175 | balloon_page_enqueue(&vb->vb_dev_info, page); |
176 | 176 | ||
177 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
178 | |||
179 | set_page_pfns(vb, vb->pfns + vb->num_pfns, page); | 177 | set_page_pfns(vb, vb->pfns + vb->num_pfns, page); |
180 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; | 178 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; |
181 | if (!virtio_has_feature(vb->vdev, | 179 | if (!virtio_has_feature(vb->vdev, |
182 | VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) | 180 | VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) |
183 | adjust_managed_page_count(page, -1); | 181 | adjust_managed_page_count(page, -1); |
182 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
184 | } | 183 | } |
185 | 184 | ||
186 | num_allocated_pages = vb->num_pfns; | 185 | num_allocated_pages = vb->num_pfns; |