Commit 3028474c authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: xgifb: properly delete MTRR region

MTRR region should be deleted on probe failure and driver removal.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 831e5bad
...@@ -2424,13 +2424,19 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2424,13 +2424,19 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
if (register_framebuffer(fb_info) < 0) { if (register_framebuffer(fb_info) < 0) {
ret = -EINVAL; ret = -EINVAL;
goto error_1; goto error_mtrr;
} }
dumpVGAReg(); dumpVGAReg();
return 0; return 0;
error_mtrr:
#ifdef CONFIG_MTRR
if (xgi_video_info.mtrr >= 0)
mtrr_del(xgi_video_info.mtrr, xgi_video_info.video_base,
xgi_video_info.video_size);
#endif /* CONFIG_MTRR */
error_1: error_1:
iounmap(xgi_video_info.mmio_vbase); iounmap(xgi_video_info.mmio_vbase);
iounmap(xgi_video_info.video_vbase); iounmap(xgi_video_info.video_vbase);
...@@ -2451,6 +2457,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, ...@@ -2451,6 +2457,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
static void __devexit xgifb_remove(struct pci_dev *pdev) static void __devexit xgifb_remove(struct pci_dev *pdev)
{ {
unregister_framebuffer(fb_info); unregister_framebuffer(fb_info);
#ifdef CONFIG_MTRR
if (xgi_video_info.mtrr >= 0)
mtrr_del(xgi_video_info.mtrr, xgi_video_info.video_base,
xgi_video_info.video_size);
#endif /* CONFIG_MTRR */
iounmap(xgi_video_info.mmio_vbase); iounmap(xgi_video_info.mmio_vbase);
iounmap(xgi_video_info.video_vbase); iounmap(xgi_video_info.video_vbase);
release_mem_region(xgi_video_info.mmio_base, xgi_video_info.mmio_size); release_mem_region(xgi_video_info.mmio_base, xgi_video_info.mmio_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment