[PATCH xf86-video-ati 06/15] Simplify drmmode_set_mode_major error handling
Michel Dänzer
michel at daenzer.net
Wed Sep 21 09:50:45 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
Initialize ret = FALSE and only set it to TRUE when we've succeeded.
(Ported from amdgpu commit 3bce0519a4008cf87c0e31a7a579e10f5dcdd2f3)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/drmmode_display.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 25c0e99..26ba9b1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -730,7 +730,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
DisplayModeRec saved_mode;
uint32_t *output_ids = NULL;
int output_count = 0;
- Bool ret = TRUE;
+ Bool ret = FALSE;
int i;
int fb_id;
drmModeModeInfo kmode;
@@ -747,10 +747,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
crtc->rotation = rotation;
output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
- if (!output_ids) {
- ret = FALSE;
+ if (!output_ids)
goto done;
- }
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
@@ -850,7 +848,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
info->front_bo->handle,
&drmmode->fb_id) < 0) {
ErrorF("failed to add fb\n");
- ret = FALSE;
goto done;
}
@@ -867,8 +864,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
fb_id, x, y, output_ids,
output_count, &kmode) != 0) {
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
- "failed to set mode: %s", strerror(errno));
- ret = FALSE;
+ "failed to set mode: %s\n", strerror(errno));
goto done;
} else
ret = TRUE;
--
2.9.3
More information about the amd-gfx
mailing list