diff options
Diffstat (limited to 'drivers/block/virtio_blk.c')
| -rw-r--r-- | drivers/block/virtio_blk.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 3cf7129d83e6..924ddd8bccd2 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -223,7 +223,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
| 223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); | 223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); |
| 224 | if (err) { | 224 | if (err) { |
| 225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); | 225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); |
| 226 | goto out_put_disk; | 226 | goto out_cleanup_queue; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /* If capacity is too big, truncate with warning. */ | 229 | /* If capacity is too big, truncate with warning. */ |
| @@ -239,7 +239,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
| 239 | blk_queue_max_segment_size(vblk->disk->queue, v); | 239 | blk_queue_max_segment_size(vblk->disk->queue, v); |
| 240 | else if (err != -ENOENT) { | 240 | else if (err != -ENOENT) { |
| 241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); | 241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); |
| 242 | goto out_put_disk; | 242 | goto out_cleanup_queue; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); | 245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); |
| @@ -247,12 +247,14 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
| 247 | blk_queue_max_hw_segments(vblk->disk->queue, v); | 247 | blk_queue_max_hw_segments(vblk->disk->queue, v); |
| 248 | else if (err != -ENOENT) { | 248 | else if (err != -ENOENT) { |
| 249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); | 249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); |
| 250 | goto out_put_disk; | 250 | goto out_cleanup_queue; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | add_disk(vblk->disk); | 253 | add_disk(vblk->disk); |
| 254 | return 0; | 254 | return 0; |
| 255 | 255 | ||
| 256 | out_cleanup_queue: | ||
| 257 | blk_cleanup_queue(vblk->disk->queue); | ||
| 256 | out_put_disk: | 258 | out_put_disk: |
| 257 | put_disk(vblk->disk); | 259 | put_disk(vblk->disk); |
| 258 | out_unregister_blkdev: | 260 | out_unregister_blkdev: |
| @@ -277,6 +279,8 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
| 277 | put_disk(vblk->disk); | 279 | put_disk(vblk->disk); |
| 278 | unregister_blkdev(major, "virtblk"); | 280 | unregister_blkdev(major, "virtblk"); |
| 279 | mempool_destroy(vblk->pool); | 281 | mempool_destroy(vblk->pool); |
| 282 | /* There should be nothing in the queue now, so no need to shutdown */ | ||
| 283 | vdev->config->del_vq(vblk->vq); | ||
| 280 | kfree(vblk); | 284 | kfree(vblk); |
| 281 | } | 285 | } |
| 282 | 286 | ||
