aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 13:25:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 13:25:09 -0400
commit0e6e58f941176033fd9a224b39527b12f9cbb05e (patch)
tree0095a8bb546ff788ea451f272165f50c8df5e20f /drivers/char
parent50edb5cc22c7b2ea7df095913596e5a649bd6b41 (diff)
parent1bbc26062754b012656d34103215f7552e02b999 (diff)
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio updates from Rusty Russell: "One cc: stable commit, the rest are a series of minor cleanups which have been sitting in MST's tree during my vacation. I changed a function name and made one trivial change, then they spent two days in linux-next" * tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (25 commits) virtio-rng: refactor probe error handling virtio_scsi: drop scan callback virtio_balloon: enable VQs early on restore virtio_scsi: fix race on device removal virito_scsi: use freezable WQ for events virtio_net: enable VQs early on restore virtio_console: enable VQs early on restore virtio_scsi: enable VQs early on restore virtio_blk: enable VQs early on restore virtio_scsi: move kick event out from virtscsi_init virtio_net: fix use after free on allocation failure 9p/trans_virtio: enable VQs early virtio_console: enable VQs early virtio_blk: enable VQs early virtio_net: enable VQs early virtio: add API to enable VQs early virtio_net: minor cleanup virtio-net: drop config_mutex virtio_net: drop config_enable virtio-blk: drop config_mutex ...
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/virtio-rng.c15
-rw-r--r--drivers/char/virtio_console.c4
2 files changed, 13 insertions, 6 deletions
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 132c9ccfdc62..72295ea2fd1c 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -109,8 +109,8 @@ static int probe_common(struct virtio_device *vdev)
109 109
110 vi->index = index = ida_simple_get(&rng_index_ida, 0, 0, GFP_KERNEL); 110 vi->index = index = ida_simple_get(&rng_index_ida, 0, 0, GFP_KERNEL);
111 if (index < 0) { 111 if (index < 0) {
112 kfree(vi); 112 err = index;
113 return index; 113 goto err_ida;
114 } 114 }
115 sprintf(vi->name, "virtio_rng.%d", index); 115 sprintf(vi->name, "virtio_rng.%d", index);
116 init_completion(&vi->have_data); 116 init_completion(&vi->have_data);
@@ -128,13 +128,16 @@ static int probe_common(struct virtio_device *vdev)
128 vi->vq = virtio_find_single_vq(vdev, random_recv_done, "input"); 128 vi->vq = virtio_find_single_vq(vdev, random_recv_done, "input");
129 if (IS_ERR(vi->vq)) { 129 if (IS_ERR(vi->vq)) {
130 err = PTR_ERR(vi->vq); 130 err = PTR_ERR(vi->vq);
131 vi->vq = NULL; 131 goto err_find;
132 kfree(vi);
133 ida_simple_remove(&rng_index_ida, index);
134 return err;
135 } 132 }
136 133
137 return 0; 134 return 0;
135
136err_find:
137 ida_simple_remove(&rng_index_ida, index);
138err_ida:
139 kfree(vi);
140 return err;
138} 141}
139 142
140static void remove_common(struct virtio_device *vdev) 143static void remove_common(struct virtio_device *vdev)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index b585b4789822..bfa640023e64 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1449,6 +1449,8 @@ static int add_port(struct ports_device *portdev, u32 id)
1449 spin_lock_init(&port->outvq_lock); 1449 spin_lock_init(&port->outvq_lock);
1450 init_waitqueue_head(&port->waitqueue); 1450 init_waitqueue_head(&port->waitqueue);
1451 1451
1452 virtio_device_ready(portdev->vdev);
1453
1452 /* Fill the in_vq with buffers so the host can send us data. */ 1454 /* Fill the in_vq with buffers so the host can send us data. */
1453 nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); 1455 nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock);
1454 if (!nr_added_bufs) { 1456 if (!nr_added_bufs) {
@@ -2182,6 +2184,8 @@ static int virtcons_restore(struct virtio_device *vdev)
2182 if (ret) 2184 if (ret)
2183 return ret; 2185 return ret;
2184 2186
2187 virtio_device_ready(portdev->vdev);
2188
2185 if (use_multiport(portdev)) 2189 if (use_multiport(portdev))
2186 fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); 2190 fill_queue(portdev->c_ivq, &portdev->c_ivq_lock);
2187 2191