drm/i915/guc: Prepare for error propagation
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 8 Feb 2022 07:01:40 +0000 (23:01 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 9 Feb 2022 07:21:28 +0000 (23:21 -0800)
commitf4044ca1967098b44bd2d569ddb99352b599551e
tree6f6908b05435b6f1b8da38603e7c9de1a9471ded
parent876f7a438e4247a948268ad77b67c494f709cc30
drm/i915/guc: Prepare for error propagation

Currently guc_mmio_reg_add() relies on having enough memory available in
the array to add a new slot. It uses
`GEM_BUG_ON(count >= regset->size);` to protect going above the
threshold.

In order to allow guc_mmio_reg_add() to handle the memory allocation by
itself, it must return an error in case of failures.  Adjust return code
so this error can be propagated to the callers of guc_mmio_reg_add() and
guc_mmio_regset_init().

No intended change in behavior.

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220208070141.2095177-2-lucas.demarchi@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c