diff options
author | weiping zhang <zhangweiping@didichuxing.com> | 2017-12-06 21:59:32 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-12-07 18:30:50 +0200 |
commit | 25f32223bce5c580e0392a176319a587d7a17e95 (patch) | |
tree | b32d101076550c42ecf00a102a421bd107bdb900 /drivers | |
parent | 7eb781b1bbb7136fe78fb8c28c1c223c61fa32b5 (diff) |
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.c | 6 |
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; |