Skip to contentSkip to conversation

fbdev: geocode: Add the missed pci_disable_device() for gx1fb_map_video_memory()

PATCH Superseded Chuhong Yuan 2 participants 2 messages Jun 3, 2020 – Jun 4, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: geocode: Add the missed pci_disable_device() for gx1fb_map_video_memory()

Although gx1fb_probe() has handled the failure of gx1fb_map_video_memory() partly, it does not call pci_disable_device() as gx1fb_map_video_memory() calls pci_enable_device().
Add the missed function call to fix the bug.

Fixes 53eed4ec8bcd ("[PATCH] fbdev: geode updates]")
---
 drivers/video/fbdev/geode/gx1fb_core.c | 37 ++++++++++++++++++--------
 1 file changed, 26 insertions(+), 11 deletions(-)
drivers/video/fbdev/geode/gx1fb_core.c +26 -11
index 5d34d89fb665..c9465542204a 100644
@@ -208,29 +208,44 @@ static int gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
 
 	ret = pci_request_region(dev, 0, "gx1fb (video)");
 	if (ret < 0)
-		return ret;
+		goto err;
 	par->vid_regs = pci_ioremap_bar(dev, 0);
-	if (!par->vid_regs)
-		return -ENOMEM;
+	if (!par->vid_regs) {
+		ret = -ENOMEM;
+		goto err;
+	}
 
-	if (!request_mem_region(gx_base + 0x8300, 0x100, "gx1fb (display controller)"))
-		return -EBUSY;
+	if (!request_mem_region(gx_base + 0x8300, 0x100,
+				"gx1fb (display controller)")) {
+		ret = -EBUSY;
+		goto err;
+	}
 	par->dc_regs = ioremap(gx_base + 0x8300, 0x100);
-	if (!par->dc_regs)
-		return -ENOMEM;
+	if (!par->dc_regs) {
+		ret = -ENOMEM;
+		goto err;
+	}
 
-	if ((fb_len = gx1_frame_buffer_size()) < 0)
-		return -ENOMEM;
+	if ((fb_len = gx1_frame_buffer_size()) < 0) {
+		ret = -ENOMEM;
+		goto err;
+	}
 	info->fix.smem_start = gx_base + 0x800000;
 	info->fix.smem_len = fb_len;
 	info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
-	if (!info->screen_base)
-		return -ENOMEM;
+	if (!info->screen_base) {
+		ret = -ENOMEM;
+		goto err;
+	}
 
 	dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n",
 		 info->fix.smem_len / 1024, info->fix.smem_start);
 
 	return 0;
+
+err:
+	pci_disable_device(dev);
+	return ret;
 }
 
 static int parse_panel_option(struct fb_info *info)
Signature · 1 line
2.26.2
#1 lore raw
Quoted 10 lines · On Wed, 3 Jun 2020 17:25:47 +0800 Chuhong Yuan <[email protected]> wrote:

Although gx1fb_probe() has handled the failure of gx1fb_map_video_memory() partly, it does not call pci_disable_device() as gx1fb_map_video_memory() calls pci_enable_device().
Add the missed function call to fix the bug.

Fixes 53eed4ec8bcd ("[PATCH] fbdev: geode updates]")
---
 drivers/video/fbdev/geode/gx1fb_core.c | 37 ++++++++++++++++++--------
 1 file changed, 26 insertions(+), 11 deletions(-)

Hi,

there is a typo in the patch subject, the driver seems to be called geode, not geocode.

Thanks,
pq