[igt-dev] [PATCH i-g-t] tests/kms_flip: Fix comparison of unsigned integers

Daniel Vetter daniel at ffwll.ch
Thu Feb 7 13:53:50 UTC 2019


On Thu, Feb 07, 2019 at 03:36:52PM +0200, Petri Latvala wrote:
> Difference of unsigned ints is unsigned int, and therefore always
> larger than zero.
> 
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>

I think we have some other tests for this, but this looks correct.

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  tests/kms_flip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index 798fc4e8..96f4a2f7 100755
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -502,7 +502,7 @@ static void check_state(const struct test_output *o, const struct event_state *e
>  	if (o->flags & TEST_TS_CONT) {
>  		/* Ignore seq_step here since vblank waits time out immediately
>  		 * when we kill the crtc. */
> -		igt_assert_f(es->current_seq - es->last_seq >= 0,
> +		igt_assert_f(es->current_seq >= es->last_seq,
>  			     "unexpected %s seq %u, should be >= %u\n",
>  			     es->name, es->current_seq, es->last_seq);
>  		igt_assert_f(es->current_seq - es->last_seq <= 150,
> -- 
> 2.19.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the igt-dev mailing list