All of lore.kernel.org
 help / color / mirror / Atom feed
From: weiping zhang <zhangweiping@didichuxing.com>
To: cohuck@redhat.com, mst@redhat.com, jasowang@redhat.com
Cc: virtualization@lists.linux-foundation.org
Subject: [PATCH v3 2/2] virtio_mmio: add cleanup for virtio_mmio_remove
Date: Wed, 6 Dec 2017 21:59:32 +0800	[thread overview]
Message-ID: <1a62b93b539bcde52f629314f04193928f02693e.1512568542.git.zhangweiping@didichuxing.com> (raw)
In-Reply-To: <cover.1512568542.git.zhangweiping@didichuxing.com>

cleanup all resource allocated by virtio_mmio_probe.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 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 @@ static int virtio_mmio_probe(struct platform_device *pdev)
 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.9.4

  parent reply	other threads:[~2017-12-06 13:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 13:58 [PATCH v3 0/2] Add cleanup for virtio_mmio driver weiping zhang
2017-12-06 13:59 ` [PATCH v3 1/2] virtio_mmio: add cleanup for virtio_mmio_probe weiping zhang
2017-12-07 11:08   ` Cornelia Huck
2017-12-06 13:59 ` weiping zhang [this message]
2017-12-07 11:09   ` [PATCH v3 2/2] virtio_mmio: add cleanup for virtio_mmio_remove Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1a62b93b539bcde52f629314f04193928f02693e.1512568542.git.zhangweiping@didichuxing.com \
    --to=zhangweiping@didichuxing.com \
    --cc=cohuck@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.