diff options
author | Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> | 2020-07-10 14:45:25 +0200 |
---|---|---|
committer | Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> | 2020-09-14 20:44:11 +0200 |
commit | 7187913c7366c5099612c0d09259ef3182740a34 (patch) | |
tree | c211ffacb84bd9be63e3633437c0155572d98d29 | |
parent | ccfb27dab0f06c009d332053548920cb740e4258 (diff) |
tests/core_hotunplug: Use igt_assert_fd()
There is a new library helper that asserts validity of open file
descriptors. Use it instead of open coding.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Reviewed-by: MichaĆ Winiarski <michal.winiarski@intel.com>
-rw-r--r-- | tests/core_hotunplug.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index e03f3b945..7431346b1 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -57,7 +57,7 @@ static void prepare_for_unbind(struct hotunplug *priv, char *buf, int buflen) priv->fd.sysfs_drv = openat(priv->fd.sysfs_dev, "device/driver", O_DIRECTORY); - igt_assert(priv->fd.sysfs_drv >= 0); + igt_assert_fd(priv->fd.sysfs_drv); len = readlinkat(priv->fd.sysfs_dev, "device", buf, buflen - 1); buf[len] = '\0'; @@ -72,10 +72,10 @@ static void prepare(struct hotunplug *priv, char *buf, int buflen) { igt_debug("opening device\n"); priv->fd.drm = __drm_open_driver(DRIVER_ANY); - igt_assert(priv->fd.drm >= 0); + igt_assert_fd(priv->fd.drm); priv->fd.sysfs_dev = igt_sysfs_open(priv->fd.drm); - igt_assert(priv->fd.sysfs_dev >= 0); + igt_assert_fd(priv->fd.sysfs_dev); if (buf) { prepare_for_unbind(priv, buf, buflen); @@ -83,7 +83,7 @@ static void prepare(struct hotunplug *priv, char *buf, int buflen) /* prepare for bus rescan */ priv->fd.sysfs_bus = openat(priv->fd.sysfs_dev, "device/subsystem", O_DIRECTORY); - igt_assert(priv->fd.sysfs_bus >= 0); + igt_assert_fd(priv->fd.sysfs_bus); } } @@ -261,7 +261,7 @@ igt_main * a device file descriptor open for exit handler use. */ fd_drm = __drm_open_driver(DRIVER_ANY); - igt_assert(fd_drm >= 0); + igt_assert_fd(fd_drm); if (is_i915_device(fd_drm)) igt_require_gem(fd_drm); |