[PATCH 1/3] staging: xgifb: properly delete MTRR region

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MTRR region should be deleted on probe failure and driver removal.

Signed-off-by: Aaro Koskinen <aaro.koskinen@xxxxxx>
---
 drivers/staging/xgifb/XGI_main_26.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index db9d27b..e018b9a 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -2424,13 +2424,19 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 
 	if (register_framebuffer(fb_info) < 0) {
 		ret = -EINVAL;
-		goto error_1;
+		goto error_mtrr;
 	}
 
 	dumpVGAReg();
 
 	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:
 	iounmap(xgi_video_info.mmio_vbase);
 	iounmap(xgi_video_info.video_vbase);
@@ -2451,6 +2457,11 @@ error:
 static void __devexit xgifb_remove(struct pci_dev *pdev)
 {
 	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.video_vbase);
 	release_mem_region(xgi_video_info.mmio_base, xgi_video_info.mmio_size);
-- 
1.7.2.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux