Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Fix build warning in debugfs
Date: Mon,  1 Dec 2014 17:19:15 -0800	[thread overview]
Message-ID: <1417483155-537-1-git-send-email-matthew.d.roper@intel.com> (raw)

i915_gem_obj_ggtt_pin() is marked as __must_check, but one callsite in
debugfs (i915_dump_lrc) was not checking the return value.  Add the
necessary check and make the debugfs node print something
semi-reasonable if we were to fail to pin.

I believe there's already in-progress discussion on the mailing list
about how this area of the code is going to be reworked in general.  But
in the meantime, this is just a quick fix to shut up the compiler
warning.

This warning was added in commit:

        commit dcb4c12a687710ab745c2cdee8298c3e97f6f707
        Author: Oscar Mateo <oscar.mateo@intel.com>
        Date:   Thu Nov 13 10:28:10 2014 +0000

            drm/i915/bdw: Pin the context backing objects to GGTT on-demand

Cc: Oscar Mateo <oscar.mateo@intel.com>
Cc: Thomas Daniel <thomas.daniel@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 7ea3843..9934ec9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1801,10 +1801,15 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
 			if (ctx_obj) {
 				struct page *page;
 				uint32_t *reg_state;
-				int j;
+				int ret, j;
 
-				i915_gem_obj_ggtt_pin(ctx_obj,
+				ret = i915_gem_obj_ggtt_pin(ctx_obj,
 						GEN8_LR_CONTEXT_ALIGN, 0);
+				if (ret) {
+					seq_printf(m, "CONTEXT: %s (unavail)\n",
+						   ring->name);
+					continue;
+				}
 
 				page = i915_gem_object_get_page(ctx_obj, 1);
 				reg_state = kmap_atomic(page);
-- 
1.8.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2014-12-02  1:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02  1:19 Matt Roper [this message]
2014-12-02  9:43 ` [PATCH] drm/i915: Fix build warning in debugfs Daniel, Thomas
2014-12-03  0:48 ` shuang.he

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417483155-537-1-git-send-email-matthew.d.roper@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox