All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915/dsb: fix cmd_buf being wrongly set
Date: Wed, 27 Nov 2019 14:11:21 -0800	[thread overview]
Message-ID: <20191127221119.384754-1-lucas.demarchi@intel.com> (raw)

The "err" label is not really "err", but rather "out" since the return
path is shared between error condition and normal path. This broke when
commit 03cea61076f0 ("drm/i915/dsb: fix extra warning on error path
handling") added a "dsb->cmd_buf = NULL;" there, making DSB to stop
working since now all writes would pass-through via mmio.

Remove the set to NULL since it's actually not needed: we only set it if
all steps are succesful. While at it, rename the label so this confusion
doesn't happen again.

Fixes: 03cea61076f0 ("drm/i915/dsb: fix extra warning on error path handling"
Resolves: https://gitlab.freedesktop.org/drm/intel/issues/8
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---

Right now I don't have access to the hw to reproduce it, so this is
build-tested only.

 drivers/gpu/drm/i915/display/intel_dsb.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
index 5bf67bdc8182..ada006a690df 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -116,34 +116,34 @@ intel_dsb_get(struct intel_crtc *crtc)
 	obj = i915_gem_object_create_internal(i915, DSB_BUF_SIZE);
 	if (IS_ERR(obj)) {
 		DRM_ERROR("Gem object creation failed\n");
-		goto err;
+		goto out;
 	}
 
 	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 0);
 	if (IS_ERR(vma)) {
 		DRM_ERROR("Vma creation failed\n");
 		i915_gem_object_put(obj);
-		goto err;
+		goto out;
 	}
 
 	buf = i915_gem_object_pin_map(vma->obj, I915_MAP_WC);
 	if (IS_ERR(buf)) {
 		DRM_ERROR("Command buffer creation failed\n");
-		goto err;
+		goto out;
 	}
 
 	dsb->id = DSB1;
 	dsb->vma = vma;
 	dsb->cmd_buf = buf;
 
-err:
+out:
 	/*
-	 * Set cmd_buf to NULL so the writes pass-through, but leave the
-	 * dangling refcount to be removed later by the corresponding
-	 * intel_dsb_put(): the important error message will already be
-	 * logged above.
+	 * On error dsb->cmd_buf will continue to be NULL, making the writes
+	 * pass-through. Leave the dangling ref to be removed later by the
+	 * corresponding intel_dsb_put(): the important error message will
+	 * already be logged above.
 	 */
-	dsb->cmd_buf = NULL;
+
 	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
 	return dsb;
-- 
2.24.0

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

WARNING: multiple messages have this Message-ID (diff)
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] drm/i915/dsb: fix cmd_buf being wrongly set
Date: Wed, 27 Nov 2019 14:11:21 -0800	[thread overview]
Message-ID: <20191127221119.384754-1-lucas.demarchi@intel.com> (raw)
Message-ID: <20191127221121.pNdpTnLqoAbbJJWfaGxdiHQQCXITwWKbOZs8QyWiy90@z> (raw)

The "err" label is not really "err", but rather "out" since the return
path is shared between error condition and normal path. This broke when
commit 03cea61076f0 ("drm/i915/dsb: fix extra warning on error path
handling") added a "dsb->cmd_buf = NULL;" there, making DSB to stop
working since now all writes would pass-through via mmio.

Remove the set to NULL since it's actually not needed: we only set it if
all steps are succesful. While at it, rename the label so this confusion
doesn't happen again.

Fixes: 03cea61076f0 ("drm/i915/dsb: fix extra warning on error path handling"
Resolves: https://gitlab.freedesktop.org/drm/intel/issues/8
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---

Right now I don't have access to the hw to reproduce it, so this is
build-tested only.

 drivers/gpu/drm/i915/display/intel_dsb.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c
index 5bf67bdc8182..ada006a690df 100644
--- a/drivers/gpu/drm/i915/display/intel_dsb.c
+++ b/drivers/gpu/drm/i915/display/intel_dsb.c
@@ -116,34 +116,34 @@ intel_dsb_get(struct intel_crtc *crtc)
 	obj = i915_gem_object_create_internal(i915, DSB_BUF_SIZE);
 	if (IS_ERR(obj)) {
 		DRM_ERROR("Gem object creation failed\n");
-		goto err;
+		goto out;
 	}
 
 	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 0);
 	if (IS_ERR(vma)) {
 		DRM_ERROR("Vma creation failed\n");
 		i915_gem_object_put(obj);
-		goto err;
+		goto out;
 	}
 
 	buf = i915_gem_object_pin_map(vma->obj, I915_MAP_WC);
 	if (IS_ERR(buf)) {
 		DRM_ERROR("Command buffer creation failed\n");
-		goto err;
+		goto out;
 	}
 
 	dsb->id = DSB1;
 	dsb->vma = vma;
 	dsb->cmd_buf = buf;
 
-err:
+out:
 	/*
-	 * Set cmd_buf to NULL so the writes pass-through, but leave the
-	 * dangling refcount to be removed later by the corresponding
-	 * intel_dsb_put(): the important error message will already be
-	 * logged above.
+	 * On error dsb->cmd_buf will continue to be NULL, making the writes
+	 * pass-through. Leave the dangling ref to be removed later by the
+	 * corresponding intel_dsb_put(): the important error message will
+	 * already be logged above.
 	 */
-	dsb->cmd_buf = NULL;
+
 	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
 	return dsb;
-- 
2.24.0

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

             reply	other threads:[~2019-11-27 22:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 22:11 Lucas De Marchi [this message]
2019-11-27 22:11 ` [Intel-gfx] [PATCH] drm/i915/dsb: fix cmd_buf being wrongly set Lucas De Marchi
2019-11-27 23:19 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2019-11-27 23:19   ` [Intel-gfx] " Patchwork
2019-11-27 23:42 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-27 23:42   ` [Intel-gfx] " Patchwork
2019-11-28 16:52 ` [PATCH] " Animesh Manna
2019-11-28 16:52   ` [Intel-gfx] " Animesh Manna
2019-11-29  3:21 ` ✗ Fi.CI.IGT: failure for " Patchwork
2019-11-29  3:21   ` [Intel-gfx] " Patchwork
2019-12-02 18:04   ` Lucas De Marchi
2019-12-02 18:04     ` [Intel-gfx] " Lucas De Marchi
2019-12-03 14:24 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork

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=20191127221119.384754-1-lucas.demarchi@intel.com \
    --to=lucas.demarchi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.