From 25f32223bce5c580e0392a176319a587d7a17e95 Mon Sep 17 00:00:00 2001 From: weiping zhang Date: Wed, 6 Dec 2017 21:59:32 +0800 Subject: [PATCH] virtio_mmio: add cleanup for virtio_mmio_remove cleanup all resource allocated by virtio_mmio_probe. Signed-off-by: weiping zhang Signed-off-by: Michael S. Tsirkin Reviewed-by: Cornelia Huck --- drivers/virtio/virtio_mmio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index ec40104..a9192fe 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; -- 2.7.4