[PATCH 7/8] Properly handle drmModeAddFB failure in drmmode_crtc_scanout_allocate

Michel Dänzer michel at daenzer.net
Tue Nov 10 23:16:05 PST 2015


From: Michel Dänzer <michel.daenzer at amd.com>

We were printing an error message, but not propagating the failure. That
would probably lead to trouble down the road.

(ported from amdgpu commit 21e72fb2418b5cc7fc849a9cf951186e209036b0)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 22b84da..17e5231 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -555,8 +555,12 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
 			   pScrn->bitsPerPixel, rotate_pitch,
 			   scanout->bo->handle,
 			   &scanout->fb_id);
-	if (ret)
+	if (ret) {
 		ErrorF("failed to add scanout fb\n");
+		radeon_bo_unref(scanout->bo);
+		scanout->bo = NULL;
+		return NULL;
+	}
 
 	scanout->width = width;
 	scanout->height = height;
-- 
2.6.2



More information about the xorg-driver-ati mailing list