<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Himal,<br>
    </p>
    <div class="moz-cite-prefix">On 5/30/2024 10:47 AM, Ghimiray, Himal
      Prasad wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:f5171a4f-5722-45a9-884a-45f006d507c2@intel.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p><br>
      </p>
      <div class="moz-cite-prefix">On 28-05-2024 15:41, Nirmoy Das
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:20240528101132.14788-1-nirmoy.das@intel.com">
        <pre class="moz-quote-pre" wrap="">xe_force_wake_get() can return error so check it's return value
before reading gpu_timestamp value.

Fixes: 188ced1e0ff8 ("drm/xe/client: Print runtime to fdinfo")
Cc: Lucas De Marchi <a class="moz-txt-link-rfc2396E"
        href="mailto:lucas.demarchi@intel.com" moz-do-not-send="true"><lucas.demarchi@intel.com></a>
Signed-off-by: Nirmoy Das <a class="moz-txt-link-rfc2396E"
        href="mailto:nirmoy.das@intel.com" moz-do-not-send="true"><nirmoy.das@intel.com></a>
---
 drivers/gpu/drm/xe/xe_drm_client.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
index 4a19b771e3a0..0c13395ffd34 100644
--- a/drivers/gpu/drm/xe/xe_drm_client.c
+++ b/drivers/gpu/drm/xe/xe_drm_client.c
@@ -245,7 +245,7 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
        struct xe_gt *gt;
        struct xe_hw_engine *hwe;
        struct xe_exec_queue *q;
-       u64 gpu_timestamp;
+       u64 gpu_timestamp = 0;
 
        xe_pm_runtime_get(xe);
 
@@ -264,7 +264,9 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
                if (!hwe)
                        continue;
 
-               xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);</pre>
      </blockquote>
      <p>This is becoming continuous efforts. How about introducing
        __must_check to  <span style="white-space: pre-wrap">xe_force_wake_get ?</span></p>
    </blockquote>
    Yes, this is a good idea.<br>
    <blockquote type="cite"
      cite="mid:f5171a4f-5722-45a9-884a-45f006d507c2@intel.com">
      <p><br>
      </p>
      <blockquote type="cite"
        cite="mid:20240528101132.14788-1-nirmoy.das@intel.com">
        <pre class="moz-quote-pre" wrap="">+          if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
+                       break;
+
                gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
                xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);</pre>
      </blockquote>
      <br>
      <p>Handle any errors that may occur if xe_force_wake_put fails,
        possibly XE_WARN_ON.<br>
      </p>
    </blockquote>
    <p>Will add that.</p>
    <p><br>
    </p>
    <p>Regards,</p>
    <p>Nirmoy<br>
    </p>
    <blockquote type="cite"
      cite="mid:f5171a4f-5722-45a9-884a-45f006d507c2@intel.com">
      <p> </p>
      <p><br>
      </p>
      <blockquote type="cite"
        cite="mid:20240528101132.14788-1-nirmoy.das@intel.com">
        <pre class="moz-quote-pre" wrap="">           break;
</pre>
      </blockquote>
    </blockquote>
  </body>
</html>