[PATCH 1/2] drm/xe: Fix static analysis tool reported errors
Matt Roper
matthew.d.roper at intel.com
Mon Mar 25 17:22:30 UTC 2024
On Fri, Mar 22, 2024 at 08:05:22PM +0530, Karthik Poosa wrote:
> Add a NULL pointer check.
> Release resources before returning error. (Riana).
Runtime PM doesn't get initialized until after we've gone through
xe_device_probe and initialized the GTs, so it shouldn't be possible to
be resuming from runtime PM with no GTs setup. And every Intel platform
has at least one GT, so we would have aborted probe if that GT failed to
come up.
Matt
>
> Fixes: 09d88e3beb64 ("drm/xe/pm: Init pcode and restore vram on power lost")
> Signed-off-by: Karthik Poosa <karthik.poosa at intel.com>
> ---
> drivers/gpu/drm/xe/xe_pm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index cc650a92c2fc..46abf63bc37b 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -383,6 +383,12 @@ int xe_pm_runtime_resume(struct xe_device *xe)
> * really lost power. Detecting primary Gt power is sufficient.
> */
> gt = xe_device_get_gt(xe, 0);
> + if (!gt) {
> + drm_err(&xe->drm, "xe_gt pointer NULL in xe_device\n");
> + err = -ENXIO;
> + goto out;
> + }
> +
> xe->d3cold.power_lost = xe_guc_in_reset(>->uc.guc);
>
> if (xe->d3cold.allowed && xe->d3cold.power_lost) {
> --
> 2.25.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list