diff mbox

drm/i915/guc: Don't leak stage descriptor pool on init failure

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

Commit Message

Michal Wajdeczko June 5, 2018, 12:05 p.m. UTC
In case of failure during GuC clients creation, we forget to
cleanup earlier pool allocation. Use proper teardown to fix that.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/i915/intel_guc_submission.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Daniele Ceraolo Spurio June 5, 2018, 5:38 p.m. UTC | #1
On 05/06/18 05:05, Michal Wajdeczko wrote:
> In case of failure during GuC clients creation, we forget to
> cleanup earlier pool allocation. Use proper teardown to fix that.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Winiarski <michal.winiarski@intel.com>

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_guc_submission.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
> index 133367a..23e9f20 100644
> --- a/drivers/gpu/drm/i915/intel_guc_submission.c
> +++ b/drivers/gpu/drm/i915/intel_guc_submission.c
> @@ -1157,7 +1157,7 @@ int intel_guc_submission_init(struct intel_guc *guc)
>   	WARN_ON(!guc_verify_doorbells(guc));
>   	ret = guc_clients_create(guc);
>   	if (ret)
> -		return ret;
> +		goto err_pool;
>   
>   	for_each_engine(engine, dev_priv, id) {
>   		guc->preempt_work[id].engine = engine;
> @@ -1166,6 +1166,9 @@ int intel_guc_submission_init(struct intel_guc *guc)
>   
>   	return 0;
>   
> +err_pool:
> +	guc_stage_desc_pool_destroy(guc);
> +	return ret;
>   }
>   
>   void intel_guc_submission_fini(struct intel_guc *guc)
>
Chris Wilson June 5, 2018, 6:22 p.m. UTC | #2
Quoting Daniele Ceraolo Spurio (2018-06-05 18:38:38)
> 
> 
> On 05/06/18 05:05, Michal Wajdeczko wrote:
> > In case of failure during GuC clients creation, we forget to
> > cleanup earlier pool allocation. Use proper teardown to fix that.
> > 
> > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Michal Winiarski <michal.winiarski@intel.com>
> 
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Applied, thank you for the patch and review.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index 133367a..23e9f20 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -1157,7 +1157,7 @@  int intel_guc_submission_init(struct intel_guc *guc)
 	WARN_ON(!guc_verify_doorbells(guc));
 	ret = guc_clients_create(guc);
 	if (ret)
-		return ret;
+		goto err_pool;
 
 	for_each_engine(engine, dev_priv, id) {
 		guc->preempt_work[id].engine = engine;
@@ -1166,6 +1166,9 @@  int intel_guc_submission_init(struct intel_guc *guc)
 
 	return 0;
 
+err_pool:
+	guc_stage_desc_pool_destroy(guc);
+	return ret;
 }
 
 void intel_guc_submission_fini(struct intel_guc *guc)