@@ -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);
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> --- tests/core_hotunplug.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)