[PATCH v3 3/7] drm/xe: Incase of action add failure, free_gsc_pkt only once

Lucas De Marchi lucas.demarchi at intel.com
Fri Apr 12 13:14:21 UTC 2024


Same comment for commit title as in previous patch. Otherwise lgtm.

	Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

Lucas De Marchi

On Fri, Apr 12, 2024 at 01:32:41PM +0530, Himal Prasad Ghimiray wrote:
>The drmm_add_action_or_reset function automatically invokes the
>action (free_gsc_pkt) in the event of a failure; therefore, there's no
>necessity to call it within the return check.
>
>Fixes: d8b1571312b7 ("drm/xe/huc: HuC authentication via GSC")
>Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
>Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
>Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
>Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
>---
> drivers/gpu/drm/xe/xe_huc.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_huc.c b/drivers/gpu/drm/xe/xe_huc.c
>index 78318d73e4cf..39a484a57585 100644
>--- a/drivers/gpu/drm/xe/xe_huc.c
>+++ b/drivers/gpu/drm/xe/xe_huc.c
>@@ -53,7 +53,6 @@ static int huc_alloc_gsc_pkt(struct xe_huc *huc)
> 	struct xe_gt *gt = huc_to_gt(huc);
> 	struct xe_device *xe = gt_to_xe(gt);
> 	struct xe_bo *bo;
>-	int err;
>
> 	/* we use a single object for both input and output */
> 	bo = xe_bo_create_pin_map(xe, gt_to_tile(gt), NULL,
>@@ -66,13 +65,7 @@ static int huc_alloc_gsc_pkt(struct xe_huc *huc)
>
> 	huc->gsc_pkt = bo;
>
>-	err = drmm_add_action_or_reset(&xe->drm, free_gsc_pkt, huc);
>-	if (err) {
>-		free_gsc_pkt(&xe->drm, huc);
>-		return err;
>-	}
>-
>-	return 0;
>+	return drmm_add_action_or_reset(&xe->drm, free_gsc_pkt, huc);
> }
>
> int xe_huc_init(struct xe_huc *huc)
>-- 
>2.25.1
>


More information about the Intel-xe mailing list