Skip to contentSkip to conversation

video: fbdev: vesafb: add missed release_region

PATCH Superseded Chuhong Yuan 2 participants 2 messages Dec 5, 2019 – Jan 15, 2020 Framebuffer layer

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 video: fbdev: vesafb: add missed release_region

The driver forgets to free the requested irq in remove and probe failure.
Add the missed calls to fix it.

---
Changes in v2:
- Modify commit message.

 drivers/video/fbdev/vesafb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/vesafb.c +2 -0
index d9c08f6c2155..fbb196a8bbf6 100644
@@ -468,6 +468,7 @@ static int vesafb_probe(struct platform_device *dev)
 	fb_info(info, "%s frame buffer device\n", info->fix.id);
 	return 0;
 err:
+	release_region(0x3c0, 32);
 	arch_phys_wc_del(par->wc_cookie);
 	if (info->screen_base)
 		iounmap(info->screen_base);
@@ -480,6 +481,7 @@ static int vesafb_remove(struct platform_device *pdev)
 {
 	struct fb_info *info = platform_get_drvdata(pdev);
 
+	release_region(0x3c0, 32);
 	unregister_framebuffer(info);
 	framebuffer_release(info);
 
Signature · 1 line
2.24.0
#1 lore raw
Quoted 2 lines · Chuhong Yuan

The driver forgets to free the requested irq in remove and probe failure.

This is I/O region not IRQ.

Quoted 15 lines

Add the missed calls to fix it.

---
Changes in v2:
- Modify commit message.

 drivers/video/fbdev/vesafb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/vesafb.c +0 -0
index d9c08f6c2155..fbb196a8bbf6 100644

drivers/video/fbdev/vesafb.c static int vesafb_probe(struct platform_device *dev) · line 471

Quoted 4 lines
drivers/video/fbdev/vesafb.c +1 -0
@@ -468,6 +468,7 @@ static int vesafb_probe(struct platform_device *dev)
 	fb_info(info, "%s frame buffer device\n", info->fix.id);
 	return 0;
 err:
+	release_region(0x3c0, 32);

There is one 'goto err;' instance before request_region() which needs to be taken care of first.

drivers/video/fbdev/vesafb.c static int vesafb_remove(struct platform_device *pdev) · line 485

Quoted 9 lines
drivers/video/fbdev/vesafb.c +1 -0
 	arch_phys_wc_del(par->wc_cookie);
 	if (info->screen_base)
 		iounmap(info->screen_base);
@@ -480,6 +481,7 @@ static int vesafb_remove(struct platform_device *pdev)
 {
 	struct fb_info *info = platform_get_drvdata(pdev);
 
+	release_region(0x3c0, 32);
 	unregister_framebuffer(info);

The order of operations on remove should be the reverse of order of operations on probe.

[ We cannot release I/O region while framebuffer is active. ]

drivers/video/fbdev/vesafb.c static int vesafb_remove(struct platform_device *pdev) · line 486

Quoted 1 line
drivers/video/fbdev/vesafb.c +0 -0
 	framebuffer_release(info);

Please fix the patch and re-submit.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics