* [PATCH next] drm/i915/huc: Fix missing error code in intel_huc_init()
@ 2023-06-14 20:41 Harshit Mogalapalli
2023-06-14 22:33 ` Ceraolo Spurio, Daniele
0 siblings, 1 reply; 2+ messages in thread
From: Harshit Mogalapalli @ 2023-06-14 20:41 UTC (permalink / raw)
To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
David Airlie, Daniel Vetter, Daniele Ceraolo Spurio,
John Harrison, Alan Previn, Harshit Mogalapalli,
Michal Wajdeczko, Greg Kroah-Hartman, intel-gfx, dri-devel,
linux-kernel
Cc: error27, dan.carpenter
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>
---
Found using Static analysis with Smatch, only compile tested.
---
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 e0afd8f89502..ddd146265beb 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(>->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;
}
--
2.41.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH next] drm/i915/huc: Fix missing error code in intel_huc_init()
2023-06-14 20:41 [PATCH next] drm/i915/huc: Fix missing error code in intel_huc_init() Harshit Mogalapalli
@ 2023-06-14 22:33 ` Ceraolo Spurio, Daniele
0 siblings, 0 replies; 2+ messages in thread
From: Ceraolo Spurio, Daniele @ 2023-06-14 22:33 UTC (permalink / raw)
To: Harshit Mogalapalli, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
Tvrtko Ursulin, David Airlie, Daniel Vetter, John Harrison,
Alan Previn, Michal Wajdeczko, Greg Kroah-Hartman, intel-gfx,
dri-devel, linux-kernel
Cc: error27, dan.carpenter
On 6/14/2023 1:41 PM, Harshit Mogalapalli wrote:
> 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>
Thanks for the fix.
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
It looks like the patch wasn't picked out by our CI, so I'm going to
re-send it to intel-gfx for testing and then merge it via drm-intel once
we get the results.
Daniele
> ---
> Found using Static analysis with Smatch, only compile tested.
> ---
> 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 e0afd8f89502..ddd146265beb 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(>->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;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-14 22:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 20:41 [PATCH next] drm/i915/huc: Fix missing error code in intel_huc_init() Harshit Mogalapalli
2023-06-14 22:33 ` Ceraolo Spurio, Daniele
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®