From: Thomas Wood Date: Thu, 6 Feb 2014 16:31:54 +0000 (+0000) Subject: lib: fix signed/unsigned comparison issues X-Git-Tag: intel-gpu-tools-1.6~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0269d1da4999ecb39ea65120a052259b19372748;p=profile%2Fextras%2Fintel-gpu-tools.git lib: fix signed/unsigned comparison issues Store the result of set_vt_mode as a signed value so that errors can be caught correctly. Signed-off-by: Thomas Wood Signed-off-by: Daniel Vetter --- diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 3960d24..5f341ff 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -620,15 +620,16 @@ static void restore_vt_mode_at_exit(int sig) void igt_set_vt_graphics_mode(void) { + long ret; + igt_install_exit_handler(restore_vt_mode_at_exit); igt_disable_exit_handler(); - orig_vt_mode = set_vt_mode(KD_GRAPHICS); - if (orig_vt_mode < 0) - orig_vt_mode = -1UL; + ret = set_vt_mode(KD_GRAPHICS); igt_enable_exit_handler(); - igt_assert(orig_vt_mode >= 0); + igt_assert(ret >= 0); + orig_vt_mode = ret; } int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,