All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe()
@ 2022-12-08  1:33 Shang XiaoJing
  2022-12-08 22:16 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: Shang XiaoJing @ 2022-12-08  1:33 UTC (permalink / raw)
  To: kwankhede, alex.williamson, kraxel, kvm; +Cc: shangxiaojing

Add missing pci_disable_device() in fail path of mdpy_fb_probe().
Besides, fix missing release functions in mdpy_fb_remove().

Fixes: cacade1946a4 ("sample: vfio mdev display - guest driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
changes in v2:
- Add missing functions in mdpy_fb_remove().
---
 samples/vfio-mdev/mdpy-fb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c
index 9ec93d90e8a5..4eb7aa11cfbb 100644
--- a/samples/vfio-mdev/mdpy-fb.c
+++ b/samples/vfio-mdev/mdpy-fb.c
@@ -109,7 +109,7 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
 
 	ret = pci_request_regions(pdev, "mdpy-fb");
 	if (ret < 0)
-		return ret;
+		goto err_disable_dev;
 
 	pci_read_config_dword(pdev, MDPY_FORMAT_OFFSET, &format);
 	pci_read_config_dword(pdev, MDPY_WIDTH_OFFSET,	&width);
@@ -191,6 +191,9 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
 err_release_regions:
 	pci_release_regions(pdev);
 
+err_disable_dev:
+	pci_disable_device(pdev);
+
 	return ret;
 }
 
@@ -199,7 +202,10 @@ static void mdpy_fb_remove(struct pci_dev *pdev)
 	struct fb_info *info = pci_get_drvdata(pdev);
 
 	unregister_framebuffer(info);
+	iounmap(info->screen_base);
 	framebuffer_release(info);
+	pci_release_regions(pdev);
+	pci_disable_device(pdev);
 }
 
 static struct pci_device_id mdpy_fb_pci_table[] = {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe()
  2022-12-08  1:33 [PATCH v2] samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe() Shang XiaoJing
@ 2022-12-08 22:16 ` Alex Williamson
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2022-12-08 22:16 UTC (permalink / raw)
  To: Shang XiaoJing; +Cc: kwankhede, kraxel, kvm

On Thu, 8 Dec 2022 09:33:41 +0800
Shang XiaoJing <shangxiaojing@huawei.com> wrote:

> Add missing pci_disable_device() in fail path of mdpy_fb_probe().
> Besides, fix missing release functions in mdpy_fb_remove().
> 
> Fixes: cacade1946a4 ("sample: vfio mdev display - guest driver")
> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> ---
> changes in v2:
> - Add missing functions in mdpy_fb_remove().
> ---
>  samples/vfio-mdev/mdpy-fb.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Applied to vfio next branch for v6.2.  Thanks,

Alex


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-08 22:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08  1:33 [PATCH v2] samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe() Shang XiaoJing
2022-12-08 22:16 ` Alex Williamson

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.