summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorweiping zhang <zhangweiping@didichuxing.com>2017-12-06 16:59:32 +0300
committerMichael S. Tsirkin <mst@redhat.com>2017-12-07 19:30:50 +0300
commit25f32223bce5c580e0392a176319a587d7a17e95 (patch)
treeb32d101076550c42ecf00a102a421bd107bdb900 /drivers
parent7eb781b1bbb7136fe78fb8c28c1c223c61fa32b5 (diff)
downloadlinux-25f32223bce5c580e0392a176319a587d7a17e95.tar.xz
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')
-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;