diff mbox

[05/66] drm/i915: Don't clear gtt with 0 entries

Message ID 1372375867-1003-6-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky June 27, 2013, 11:30 p.m. UTC
This will help keep the next patch cleaner which will conditionally clear
the guard page, and use 0 num_entries when not actually clear space for
guard page.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 216e7a1..0fce8d0 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -516,6 +516,9 @@  static void gen6_ggtt_clear_range(struct drm_device *dev,
 	const int max_entries = gtt_total_entries(dev_priv->gtt) - first_entry;
 	int i;
 
+	if (num_entries == 0)
+		return;
+
 	if (WARN(num_entries > max_entries,
 		 "First entry = %d; Num entries = %d (max=%d)\n",
 		 first_entry, num_entries, max_entries))
@@ -546,6 +549,9 @@  static void i915_ggtt_clear_range(struct drm_device *dev,
 				  unsigned int first_entry,
 				  unsigned int num_entries)
 {
+	if (num_entries == 0)
+		return;
+
 	intel_gtt_clear_range(first_entry, num_entries);
 }