diff mbox series

[v2,02/10] drm/fb-helper: Unmap client buffer during shutdown

Message ID 20201120102545.4047-3-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/fb-helper: Various fixes and cleanups | expand

Commit Message

Thomas Zimmermann Nov. 20, 2020, 10:25 a.m. UTC
The fbdev helper's generic probe function establishes a mapping for
framebuffers without shadow buffer. The clean-up function did not unmap
the buffer object. Add the unmap operation.

As fbdev devices are usally released during system shutdown, this has
not been a problem in practice.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_fb_helper.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Sam Ravnborg Nov. 23, 2020, 7:20 p.m. UTC | #1
On Fri, Nov 20, 2020 at 11:25:37AM +0100, Thomas Zimmermann wrote:
> The fbdev helper's generic probe function establishes a mapping for
> framebuffers without shadow buffer. The clean-up function did not unmap
> the buffer object. Add the unmap operation.
> 
> As fbdev devices are usally released during system shutdown, this has
> not been a problem in practice.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 9c673f33d222..aa7af463c50d 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1988,14 +1988,19 @@  static void drm_fbdev_cleanup(struct drm_fb_helper *fb_helper)
 	if (!fb_helper->dev)
 		return;
 
-	if (fbi && fbi->fbdefio) {
-		fb_deferred_io_cleanup(fbi);
-		shadow = fbi->screen_buffer;
+	if (fbi) {
+		if (fbi->fbdefio)
+			fb_deferred_io_cleanup(fbi);
+		if (drm_fbdev_use_shadow_fb(fb_helper))
+			shadow = fbi->screen_buffer;
 	}
 
 	drm_fb_helper_fini(fb_helper);
 
-	vfree(shadow);
+	if (shadow)
+		vfree(shadow);
+	else
+		drm_client_buffer_vunmap(fb_helper->buffer);
 
 	drm_client_framebuffer_delete(fb_helper->buffer);
 }