[PATCH 1/2] drm/xe: Fix static analysis tool reported errors
Riana Tauro
riana.tauro at intel.com
Fri Mar 22 06:20:31 UTC 2024
Hi Karthik
On 3/22/2024 11:34 AM, Gupta, Anshuman wrote:
>
>
>> -----Original Message-----
>> From: Poosa, Karthik <karthik.poosa at intel.com>
>> Sent: Thursday, March 21, 2024 4:16 PM
>> To: intel-xe at lists.freedesktop.org
>> Cc: Gupta, Anshuman <anshuman.gupta at intel.com>; Nilawar, Badal
>> <badal.nilawar at intel.com>; Poosa, Karthik <karthik.poosa at intel.com>
>> Subject: [PATCH 1/2] drm/xe: Fix static analysis tool reported errors
>>
>> Add a NULL pointer check.
>>
>> Fixes: 09d88e3beb64 ("drm/xe/pm: Init pcode and restore vram on power lost")
>> Signed-off-by: Karthik Poosa <karthik.poosa at intel.com>
> Reviewed-by: Anshuman Gupta <anshuman.gupta 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..5cb5aef16823 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 (!gt) {
>> + drm_err(&xe->drm, "xe_gt pointer NULL in xe_device\n");
You can just print "gt is NULL"
>> + return -ENXIO;
You need to set err and goto out and release the previous resources
Thanks,
Riana
>> + }
>> +
>> xe->d3cold.power_lost = xe_guc_in_reset(>->uc.guc);
>>
>> if (xe->d3cold.allowed && xe->d3cold.power_lost) {
>> --
>> 2.25.1
>
More information about the Intel-xe
mailing list