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

Jani Nikula jani.nikula at linux.intel.com
Mon Mar 25 09:44:21 UTC 2024


The subject should describe the change, not the tool.

We're not interested in the tool, we're interested in the change, and
why it's being made. And the reason why is also not the tool, but the
actual reason the NULL check should be done.

BR,
Jani.


On Mon, 25 Mar 2024, Karthik Poosa <karthik.poosa at intel.com> wrote:
> Add a NULL pointer check.
>
> v2: Release resources before returning error. (Riana)
>
> v3: Update commit message. (Badal)
>
> v4: Change drm_err to XE_WARN_ON. (Anshuman)
>
> v5: Fix XE_WARN_ON check. (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 | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
> index cc650a92c2fc..f6837bd6f9a3 100644
> --- a/drivers/gpu/drm/xe/xe_pm.c
> +++ b/drivers/gpu/drm/xe/xe_pm.c
> @@ -383,6 +383,11 @@ 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 (XE_WARN_ON(!gt)) {
> +		err = -ENXIO;
> +		goto out;
> +	}
> +
>  	xe->d3cold.power_lost = xe_guc_in_reset(&gt->uc.guc);
>  
>  	if (xe->d3cold.allowed && xe->d3cold.power_lost) {

-- 
Jani Nikula, Intel


More information about the Intel-xe mailing list