mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-09 00:46:17 +00:00
lib: remove unnecessary checks on the drm_open_any return value
drm_open_any always returns a valid file descriptor, so there is no need to check the return value. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
07e9f3edb9
commit
032f30cb38
@ -302,10 +302,10 @@ static void quiescent_gpu_at_exit_render(int sig)
|
|||||||
/**
|
/**
|
||||||
* drm_open_any:
|
* drm_open_any:
|
||||||
*
|
*
|
||||||
* Open an i915 drm legacy device node.
|
* Open an i915 drm legacy device node. This function always returns a valid
|
||||||
|
* file descriptor.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns: a i915 drm file descriptor
|
||||||
* The i915 drm file descriptor or -1 on error
|
|
||||||
*/
|
*/
|
||||||
int drm_open_any(void)
|
int drm_open_any(void)
|
||||||
{
|
{
|
||||||
|
@ -127,3 +127,17 @@ expression b;
|
|||||||
- ((a) >= (b) ? (a) : (b))
|
- ((a) >= (b) ? (a) : (b))
|
||||||
+ max(a, b)
|
+ max(a, b)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// drm_open_any always returns a valid file descriptor
|
||||||
|
@@
|
||||||
|
expression a;
|
||||||
|
@@
|
||||||
|
a = drm_open_any();
|
||||||
|
(
|
||||||
|
- igt_assert(a >= 0);
|
||||||
|
|
|
||||||
|
- if (a < 0) {
|
||||||
|
- ...
|
||||||
|
- return ...;
|
||||||
|
- }
|
||||||
|
)
|
||||||
|
@ -15,8 +15,6 @@ int main(void)
|
|||||||
signal(SIGALRM, SIG_IGN);
|
signal(SIGALRM, SIG_IGN);
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
if (fd < 0)
|
|
||||||
return IGT_EXIT_SKIP;
|
|
||||||
|
|
||||||
alarm(1);
|
alarm(1);
|
||||||
if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0)
|
if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0)
|
||||||
|
@ -103,7 +103,6 @@ static void test_flink_name(void)
|
|||||||
threads = calloc(num_threads, sizeof(pthread_t));
|
threads = calloc(num_threads, sizeof(pthread_t));
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
for (i = 0; i < num_threads; i++) {
|
for (i = 0; i < num_threads; i++) {
|
||||||
r = pthread_create(&threads[i], NULL,
|
r = pthread_create(&threads[i], NULL,
|
||||||
@ -173,7 +172,6 @@ static void test_flink_close(void)
|
|||||||
threads = calloc(num_threads, sizeof(pthread_t));
|
threads = calloc(num_threads, sizeof(pthread_t));
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
for (i = 0; i < num_threads; i++) {
|
for (i = 0; i < num_threads; i++) {
|
||||||
r = pthread_create(&threads[i], NULL,
|
r = pthread_create(&threads[i], NULL,
|
||||||
|
@ -520,10 +520,8 @@ static void test_ban(void)
|
|||||||
struct local_drm_i915_reset_stats rs_bad, rs_good;
|
struct local_drm_i915_reset_stats rs_bad, rs_good;
|
||||||
|
|
||||||
fd_bad = drm_open_any();
|
fd_bad = drm_open_any();
|
||||||
igt_assert(fd_bad >= 0);
|
|
||||||
|
|
||||||
fd_good = drm_open_any();
|
fd_good = drm_open_any();
|
||||||
igt_assert(fd_good >= 0);
|
|
||||||
|
|
||||||
assert_reset_status(fd_bad, 0, RS_NO_ERROR);
|
assert_reset_status(fd_bad, 0, RS_NO_ERROR);
|
||||||
assert_reset_status(fd_good, 0, RS_NO_ERROR);
|
assert_reset_status(fd_good, 0, RS_NO_ERROR);
|
||||||
@ -609,7 +607,6 @@ static void test_ban_ctx(void)
|
|||||||
struct local_drm_i915_reset_stats rs_bad, rs_good;
|
struct local_drm_i915_reset_stats rs_bad, rs_good;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
assert_reset_status(fd, 0, RS_NO_ERROR);
|
assert_reset_status(fd, 0, RS_NO_ERROR);
|
||||||
|
|
||||||
@ -749,7 +746,6 @@ static void test_close_pending_ctx(void)
|
|||||||
uint32_t ctx;
|
uint32_t ctx;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
ctx = context_create(fd);
|
ctx = context_create(fd);
|
||||||
|
|
||||||
assert_reset_status(fd, ctx, RS_NO_ERROR);
|
assert_reset_status(fd, ctx, RS_NO_ERROR);
|
||||||
@ -768,7 +764,6 @@ static void test_close_pending(void)
|
|||||||
int fd, h;
|
int fd, h;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
assert_reset_status(fd, 0, RS_NO_ERROR);
|
assert_reset_status(fd, 0, RS_NO_ERROR);
|
||||||
|
|
||||||
@ -831,7 +826,6 @@ static void test_close_pending_fork(const bool reverse)
|
|||||||
int fd, h;
|
int fd, h;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
assert_reset_status(fd, 0, RS_NO_ERROR);
|
assert_reset_status(fd, 0, RS_NO_ERROR);
|
||||||
|
|
||||||
@ -871,7 +865,6 @@ static void test_close_pending_fork(const bool reverse)
|
|||||||
|
|
||||||
/* Then we just wait on hang to happen */
|
/* Then we just wait on hang to happen */
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
h = exec_valid(fd, 0);
|
h = exec_valid(fd, 0);
|
||||||
igt_assert(h >= 0);
|
igt_assert(h >= 0);
|
||||||
@ -887,7 +880,6 @@ static void test_reset_count(const bool create_ctx)
|
|||||||
long c1, c2;
|
long c1, c2;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
if (create_ctx)
|
if (create_ctx)
|
||||||
ctx = context_create(fd);
|
ctx = context_create(fd);
|
||||||
else
|
else
|
||||||
@ -998,7 +990,6 @@ static void test_params_ctx(void)
|
|||||||
int fd, ctx;
|
int fd, ctx;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
ctx = context_create(fd);
|
ctx = context_create(fd);
|
||||||
|
|
||||||
_test_param(fd, ctx);
|
_test_param(fd, ctx);
|
||||||
@ -1011,7 +1002,6 @@ static void test_params(void)
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
_test_param(fd, 0);
|
_test_param(fd, 0);
|
||||||
|
|
||||||
@ -1025,7 +1015,6 @@ static void defer_hangcheck(int ring_num)
|
|||||||
int seconds = 30;
|
int seconds = 30;
|
||||||
const struct target_ring *next_ring;
|
const struct target_ring *next_ring;
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
next_ring = &rings[(++ring_num) % NUM_RINGS];
|
next_ring = &rings[(++ring_num) % NUM_RINGS];
|
||||||
|
@ -187,7 +187,6 @@ static void run_sync_test(int num_buffers, bool verify)
|
|||||||
struct igt_buf *s_src, *s_dst;
|
struct igt_buf *s_src, *s_dst;
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
gem_quiescent_gpu(fd);
|
gem_quiescent_gpu(fd);
|
||||||
|
|
||||||
|
@ -269,7 +269,6 @@ static void test_reimport_close_race(void)
|
|||||||
threads = calloc(num_threads, sizeof(pthread_t));
|
threads = calloc(num_threads, sizeof(pthread_t));
|
||||||
|
|
||||||
fds[0] = drm_open_any();
|
fds[0] = drm_open_any();
|
||||||
igt_assert(fds[0] >= 0);
|
|
||||||
|
|
||||||
handle = gem_create(fds[0], BO_SIZE);
|
handle = gem_create(fds[0], BO_SIZE);
|
||||||
|
|
||||||
@ -349,7 +348,6 @@ static void test_export_close_race(void)
|
|||||||
threads = calloc(num_threads, sizeof(pthread_t));
|
threads = calloc(num_threads, sizeof(pthread_t));
|
||||||
|
|
||||||
fd = drm_open_any();
|
fd = drm_open_any();
|
||||||
igt_assert(fd >= 0);
|
|
||||||
|
|
||||||
obj_count = get_object_count();
|
obj_count = get_object_count();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user