[PATCH igt 3/8] lib/igt_gt: has_gpu_reset(): fix failed assertion on non-i915 platforms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Checks if we have an i915 device before using intel_get_drm_devid().

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@xxxxxxxxx>
---
 lib/igt_gt.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index e630550..9cb07c2 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -59,14 +59,17 @@ static bool has_gpu_reset(int fd)
 		struct drm_i915_getparam gp;
 		int val = 0;
 
-		memset(&gp, 0, sizeof(gp));
-		gp.param = 35; /* HAS_GPU_RESET */
-		gp.value = &val;
-
-		if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp))
-			once = intel_gen(intel_get_drm_devid(fd)) >= 5;
-		else
-			once = val > 0;
+		if (is_i915_device(fd)) {
+			memset(&gp, 0, sizeof(gp));
+			gp.param = 35; /* HAS_GPU_RESET */
+			gp.value = &val;
+
+			if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp))
+				once = intel_gen(intel_get_drm_devid(fd)) >= 5;
+			else
+				once = val > 0;
+		} else
+			once = 0;
 	}
 	return once;
 }
-- 
2.7.4




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux