diff mbox series

[4/4] Klock work Fix for uninitialized array intel_migrate.c

Message ID 20210628143829.22995-5-krishnaiah.bommu@intel.com (mailing list archive)
State New, archived
Headers show
Series The Following Patches are to Fix the Critical KclockWork Errors in i915_gem and gt | expand

Commit Message

Bommu, Krishnaiah June 28, 2021, 2:38 p.m. UTC
Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_migrate.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ramalingam C June 29, 2021, 8:52 a.m. UTC | #1
On 2021-06-28 at 20:08:29 +0530, Bommu Krishnaiah wrote:
> Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/gt/intel_migrate.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
> index 23c59ce66cee5..5df7b8af6fdb9 100644
> --- a/drivers/gpu/drm/i915/gt/intel_migrate.c
> +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
> @@ -208,11 +208,15 @@ static struct intel_context *__migrate_engines(struct intel_gt *gt)
>  
>  	count = 0;
>  	for (i = 0; i < ARRAY_SIZE(gt->engine_class[COPY_ENGINE_CLASS]); i++) {
> +
>  		engine = gt->engine_class[COPY_ENGINE_CLASS][i];
>  		if (engine_supports_migration(engine))
>  			engines[count++] = engine;
>  	}
>  
> +	if (count == 0)
> +		return ERR_PTR(-ENXIO);
> +
>  	return intel_context_create(engines[random_index(count)]);
This Kclockwork warning/error is false positive.

As intel_migrate_copy->intel_migrate_create_context->__migrate_engines is called
after the checkfor valid m->context which is created for first copy engine.

So atleast one blitter is assured. hence we can ignore this Kclockwork
result.

Ram.
>  }
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
index 23c59ce66cee5..5df7b8af6fdb9 100644
--- a/drivers/gpu/drm/i915/gt/intel_migrate.c
+++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
@@ -208,11 +208,15 @@  static struct intel_context *__migrate_engines(struct intel_gt *gt)
 
 	count = 0;
 	for (i = 0; i < ARRAY_SIZE(gt->engine_class[COPY_ENGINE_CLASS]); i++) {
+
 		engine = gt->engine_class[COPY_ENGINE_CLASS][i];
 		if (engine_supports_migration(engine))
 			engines[count++] = engine;
 	}
 
+	if (count == 0)
+		return ERR_PTR(-ENXIO);
+
 	return intel_context_create(engines[random_index(count)]);
 }