intel: tools: dump: only store device id on success
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 23 Jul 2018 14:39:12 +0000 (15:39 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 25 Jul 2018 15:53:06 +0000 (16:53 +0100)
We might fail on master node drm fd because we won't have the right
permissions.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/intel/tools/intel_dump_gpu.c

index 1abe54147cff5032870ec046fb003f36c0a81338..a71103f18895ea396258e52ec7d13bc0b1e262c5 100644 (file)
@@ -111,7 +111,7 @@ align_u32(uint32_t v, uint32_t a)
 }
 
 static struct gen_device_info devinfo = {0};
-static uint32_t device;
+static uint32_t device = 0;
 static struct aub_file aub_file;
 
 static void *
@@ -419,7 +419,7 @@ ioctl(int fd, unsigned long request, ...)
           * (they typically do), we'll piggy-back on
           * their ioctl and store the id for later
           * use. */
-         if (getparam->param == I915_PARAM_CHIPSET_ID)
+         if (ret == 0 && getparam->param == I915_PARAM_CHIPSET_ID)
             device = *getparam->value;
 
          return ret;