diff mbox series

[CI] drm/i915/huc: Fix missing error code in intel_huc_init()

Message ID 20230614223646.2583633-1-daniele.ceraolospurio@intel.com (mailing list archive)
State New, archived
Headers show
Series [CI] drm/i915/huc: Fix missing error code in intel_huc_init() | expand

Commit Message

Daniele Ceraolo Spurio June 14, 2023, 10:36 p.m. UTC
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>

Smatch warns:
	drivers/gpu/drm/i915/gt/uc/intel_huc.c:388
	    intel_huc_init() warn: missing error code 'err'

When the allocation of VMAs fail: The value of err is zero at this
point and it is passed to PTR_ERR and also finally returning zero which
is success instead of failure.

Fix this by adding the missing error code when VMA allocation fails.

Fixes: 08872cb13a71 ("drm/i915/mtl/huc: auth HuC via GSC")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---

Re-sending for testing, because it looks like the original didn't make
it to intel-gfx and patchwork.

 drivers/gpu/drm/i915/gt/uc/intel_huc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniele Ceraolo Spurio June 15, 2023, 9:17 p.m. UTC | #1
On 6/14/2023 3:36 PM, Daniele Ceraolo Spurio wrote:
> From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>
> Smatch warns:
> 	drivers/gpu/drm/i915/gt/uc/intel_huc.c:388
> 	    intel_huc_init() warn: missing error code 'err'
>
> When the allocation of VMAs fail: The value of err is zero at this
> point and it is passed to PTR_ERR and also finally returning zero which
> is success instead of failure.
>
> Fix this by adding the missing error code when VMA allocation fails.
>
> Fixes: 08872cb13a71 ("drm/i915/mtl/huc: auth HuC via GSC")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

CI came back green, so patch merged.

Daniele

> ---
>
> Re-sending for testing, because it looks like the original didn't make
> it to intel-gfx and patchwork.
>
>   drivers/gpu/drm/i915/gt/uc/intel_huc.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> index d3a7219e9ed1..bb95bdd1c3f9 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
> @@ -384,6 +384,7 @@ int intel_huc_init(struct intel_huc *huc)
>   
>   		vma = intel_guc_allocate_vma(&gt->uc.guc, PXP43_HUC_AUTH_INOUT_SIZE * 2);
>   		if (IS_ERR(vma)) {
> +			err = PTR_ERR(vma);
>   			huc_info(huc, "Failed to allocate heci pkt\n");
>   			goto out;
>   		}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
index d3a7219e9ed1..bb95bdd1c3f9 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
@@ -384,6 +384,7 @@  int intel_huc_init(struct intel_huc *huc)
 
 		vma = intel_guc_allocate_vma(&gt->uc.guc, PXP43_HUC_AUTH_INOUT_SIZE * 2);
 		if (IS_ERR(vma)) {
+			err = PTR_ERR(vma);
 			huc_info(huc, "Failed to allocate heci pkt\n");
 			goto out;
 		}