diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-01-10 09:19:31 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-01-10 21:56:56 +0000 |
commit | 4cd3da7e32d4ad7efe3d1abd2f03e4e133309e87 (patch) | |
tree | 7a741377f1a22552708872d70c8ae75ec66c1996 | |
parent | f01796214bbde31e37b0593e547ad9436fdd02ba (diff) |
lib/sysfs: Repair override of params with -1
Commit e27626898b87 ("igt: Check the physical swizzle status") stopped
trying to chase the parameters from the device sysfs, entirely by
accident. Make it a tiny bit more robust by forgiving the sysfs device
not being present and jumping to the /sys/module + driver name param
lookup fallback.
Reported-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | lib/igt_sysfs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c index d323b81d..cce342a0 100644 --- a/lib/igt_sysfs.c +++ b/lib/igt_sysfs.c @@ -189,7 +189,7 @@ bool igt_sysfs_set_parameter(int device, /** * igt_sysfs_open_parameters: - * @device: fd of the device (or -1 to default to Intel) + * @device: fd of the device * * This opens the module parameters directory (under sysfs) corresponding * to the device for use with igt_sysfs_set() and igt_sysfs_get(). @@ -199,15 +199,15 @@ bool igt_sysfs_set_parameter(int device, */ int igt_sysfs_open_parameters(int device) { - int dir, params; + int dir, params = -1; dir = igt_sysfs_open(device, ¶ms); - if (dir < 0) - return -1; - - params = -1; - //params = openat(dir, "device/driver/module/parameters", O_RDONLY); - close(dir); + if (dir >= 0) { + params = openat(dir, + "device/driver/module/parameters", + O_RDONLY); + close(dir); + } if (params < 0) { /* builtin? */ drm_version_t version; |