diff mbox series

drm/i915/guc: Correctly free guc capture struct on error

Message ID 20220324000439.2370440-1-daniele.ceraolospurio@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/guc: Correctly free guc capture struct on error | expand

Commit Message

Daniele Ceraolo Spurio March 24, 2022, 12:04 a.m. UTC
On error the "new" allocation is not freed, so add the required kfree.

Fixes: 247f8071d5893 ("drm/i915/guc: Pre-allocate output nodes for extraction")
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: John Harrison <john.c.harrison@intel.com>
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Nirmoy Das March 24, 2022, 9:35 a.m. UTC | #1
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

On 3/24/2022 1:04 AM, Daniele Ceraolo Spurio wrote:
> On error the "new" allocation is not freed, so add the required kfree.
>
> Fixes: 247f8071d5893 ("drm/i915/guc: Pre-allocate output nodes for extraction")
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
> Cc: John Harrison <john.c.harrison@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
> index afdcbe63e9eb1..c4e25966d3e9f 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
> @@ -1040,6 +1040,7 @@ guc_capture_alloc_one_node(struct intel_guc *guc)
>   		if (!new->reginfo[i].regs) {
>   			while (i)
>   				kfree(new->reginfo[--i].regs);
> +			kfree(new);
>   			return NULL;
>   		}
>   	}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
index afdcbe63e9eb1..c4e25966d3e9f 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c
@@ -1040,6 +1040,7 @@  guc_capture_alloc_one_node(struct intel_guc *guc)
 		if (!new->reginfo[i].regs) {
 			while (i)
 				kfree(new->reginfo[--i].regs);
+			kfree(new);
 			return NULL;
 		}
 	}