diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/virtio-rng.c | 15 | ||||
-rw-r--r-- | drivers/char/virtio_console.c | 4 |
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 | |||
136 | err_find: | ||
137 | ida_simple_remove(&rng_index_ida, index); | ||
138 | err_ida: | ||
139 | kfree(vi); | ||
140 | return err; | ||
138 | } | 141 | } |
139 | 142 | ||
140 | static void remove_common(struct virtio_device *vdev) | 143 | static 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 | ||