diff mbox

drm/i915: Tidy error handling in i915_gem_init_hw

Message ID 20180712124810.25241-1-michal.winiarski@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michał Winiarski July 12, 2018, 12:48 p.m. UTC
Let's reorder things so that we can do onion teardown rather than double
goto.

References: b96f6ebfd024 ("drm/i915: Correctly handle error path in i915_gem_init_hw")
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Chris Wilson July 12, 2018, 12:58 p.m. UTC | #1
Quoting Michał Winiarski (2018-07-12 13:48:10)
> Let's reorder things so that we can do onion teardown rather than double
> goto.
> 
> References: b96f6ebfd024 ("drm/i915: Correctly handle error path in i915_gem_init_hw")
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>

Ok. My pasta punning pedantry pales away,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Chris Wilson July 12, 2018, 2:32 p.m. UTC | #2
Quoting Michał Winiarski (2018-07-12 13:48:10)
> Let's reorder things so that we can do onion teardown rather than double
> goto.
> 
> References: b96f6ebfd024 ("drm/i915: Correctly handle error path in i915_gem_init_hw")
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>

Thanks for the patch, pushed.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 07a92ca61dbf..ed2be33ec58a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5313,13 +5313,17 @@  int i915_gem_init_hw(struct drm_i915_private *dev_priv)
 	ret = __i915_gem_restart_engines(dev_priv);
 	if (ret)
 		goto cleanup_uc;
-out:
+
 	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
-	return ret;
+
+	return 0;
 
 cleanup_uc:
 	intel_uc_fini_hw(dev_priv);
-	goto out;
+out:
+	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
+
+	return ret;
 }
 
 static int __intel_engines_record_defaults(struct drm_i915_private *i915)