Skip to content

Commit d1f0f50

Browse files
Shang XiaoJingawilliam
authored andcommitted
samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe()
Add missing pci_disable_device() in fail path of mdpy_fb_probe(). Besides, fix missing release functions in mdpy_fb_remove(). Fixes: cacade1 ("sample: vfio mdev display - guest driver") Signed-off-by: Shang XiaoJing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent f2240b4 commit d1f0f50

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

samples/vfio-mdev/mdpy-fb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
109109

110110
ret = pci_request_regions(pdev, "mdpy-fb");
111111
if (ret < 0)
112-
return ret;
112+
goto err_disable_dev;
113113

114114
pci_read_config_dword(pdev, MDPY_FORMAT_OFFSET, &format);
115115
pci_read_config_dword(pdev, MDPY_WIDTH_OFFSET, &width);
@@ -191,6 +191,9 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
191191
err_release_regions:
192192
pci_release_regions(pdev);
193193

194+
err_disable_dev:
195+
pci_disable_device(pdev);
196+
194197
return ret;
195198
}
196199

@@ -199,7 +202,10 @@ static void mdpy_fb_remove(struct pci_dev *pdev)
199202
struct fb_info *info = pci_get_drvdata(pdev);
200203

201204
unregister_framebuffer(info);
205+
iounmap(info->screen_base);
202206
framebuffer_release(info);
207+
pci_release_regions(pdev);
208+
pci_disable_device(pdev);
203209
}
204210

205211
static struct pci_device_id mdpy_fb_pci_table[] = {

0 commit comments

Comments
 (0)