diff mbox series

[i-g-t,4/7] kms_flip: Remove unreachable condition in wait_for_events

Message ID 55bbf175b5fc0bee6927cb8de2853be2b4a9cd18.1551712108.git.rodrigosiqueiramelo@gmail.com (mailing list archive)
State New, archived
Headers show
Series kms_flip: cleanups | expand

Commit Message

Rodrigo Siqueira March 4, 2019, 3:30 p.m. UTC
In the function wait_for_events() has a double check in the select()
function return as described below:

  igt_assert_f(ret >= 0,
        "select error (errno %i)\n", errno);
  igt_assert_f(ret > 0,
        "select timed out or error (ret %d)\n", ret);

Note that the second assert condition will not be reached because of the
first assertion. This commit removes the code duplication and update the
error message.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 tests/kms_flip.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Petri Latvala March 5, 2019, 10:39 a.m. UTC | #1
On Mon, Mar 04, 2019 at 12:30:55PM -0300, Rodrigo Siqueira wrote:
> In the function wait_for_events() has a double check in the select()
> function return as described below:
> 
>   igt_assert_f(ret >= 0,
>         "select error (errno %i)\n", errno);
>   igt_assert_f(ret > 0,
>         "select timed out or error (ret %d)\n", ret);
> 
> Note that the second assert condition will not be reached because of the
> first assertion. This commit removes the code duplication and update the
> error message.

It will be reached if ret equals 0.

If select() returns 0, errno is unspecified, the main reason for the
separation.
diff mbox series

Patch

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 57138ec1..9ef77de9 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1014,9 +1014,7 @@  static unsigned int wait_for_events(struct test_output *o)
 		} while (ret < 0 && errno == EINTR);
 
 		igt_assert_f(ret >= 0,
-			     "select error (errno %i)\n", errno);
-		igt_assert_f(ret > 0,
-			     "select timed out or error (ret %d)\n", ret);
+			     "select error: %s (%d))\n", strerror(errno), ret);
 		igt_assert_f(!FD_ISSET(0, &fds),
 			     "no fds active, breaking\n");