summaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorweiping zhang <zhangweiping@didichuxing.com>2017-12-06 14:59:32 +0100
committerMichael S. Tsirkin <mst@redhat.com>2017-12-07 17:30:50 +0100
commit25f32223bce5c580e0392a176319a587d7a17e95 (patch)
treeb32d101076550c42ecf00a102a421bd107bdb900 /drivers/virtio
parentvirtio_mmio: add cleanup for virtio_mmio_probe (diff)
downloadlinux-25f32223bce5c580e0392a176319a587d7a17e95.tar.xz
linux-25f32223bce5c580e0392a176319a587d7a17e95.zip
virtio_mmio: add cleanup for virtio_mmio_remove
cleanup all resource allocated by virtio_mmio_probe. Signed-off-by: weiping zhang <zhangweiping@didichuxing.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_mmio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index ec401042a5d1..a9192fe4f345 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -610,7 +610,13 @@ free_vmdev:
static int virtio_mmio_remove(struct platform_device *pdev)
{
struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
+ struct resource *mem;
+ iounmap(vm_dev->base);
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (mem)
+ devm_release_mem_region(&pdev->dev, mem->start,
+ resource_size(mem));
unregister_virtio_device(&vm_dev->vdev);
return 0;