[PATCH] drm/xe: Fix static analysis tool reported errors

Nilawar, Badal badal.nilawar at intel.com
Sat Mar 23 05:07:02 UTC 2024



On 23-03-2024 10:18, Karthik Poosa wrote:
> Add a NULL pointer check.
> Release resources before returning error. (Riana).
Put this as v2: Release resources before returning error. (Riana).
> 
> 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(&gt->uc.guc);
>   
>   	if (xe->d3cold.allowed && xe->d3cold.power_lost) {
With a comment this is
Reviewed-by: Badal Nilawar <badal.nilawar at intel.com>


More information about the Intel-xe mailing list