Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Fix static analysis tool reported errors
@ 2024-03-25  8:05 Karthik Poosa
  2024-03-25  8:01 ` ✓ CI.Patch_applied: success for drm/xe: Fix static analysis tool reported errors (rev5) Patchwork
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Karthik Poosa @ 2024-03-25  8:05 UTC (permalink / raw)
  To: intel-xe; +Cc: anshuman.gupta, badal.nilawar, riana.tauro, Karthik Poosa

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@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) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] drm/xe: Fix static analysis tool reported errors
@ 2024-03-25  3:53 Karthik Poosa
  2024-03-25  6:18 ` Riana Tauro
  0 siblings, 1 reply; 21+ messages in thread
From: Karthik Poosa @ 2024-03-25  3:53 UTC (permalink / raw)
  To: intel-xe; +Cc: anshuman.gupta, badal.nilawar, riana.tauro, Karthik Poosa

Add a NULL pointer check.

v2: Release resources before returning error. (Riana)

v3: Change drm_err to XE_WARN_ON. (Anshuman)

Fixes: 09d88e3beb64 ("drm/xe/pm: Init pcode and restore vram on power lost")
Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@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..bbb2ec25aee4 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) {
+		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) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] drm/xe: Fix static analysis tool reported errors
@ 2024-03-23 12:13 Karthik Poosa
  0 siblings, 0 replies; 21+ messages in thread
From: Karthik Poosa @ 2024-03-23 12:13 UTC (permalink / raw)
  To: intel-xe; +Cc: anshuman.gupta, badal.nilawar, riana.tauro, Karthik Poosa

Add a NULL pointer check.

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@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@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) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] drm/xe: Fix static analysis tool reported errors
@ 2024-03-23 10:53 Karthik Poosa
  2024-03-24  4:00 ` Gupta, Anshuman
  0 siblings, 1 reply; 21+ messages in thread
From: Karthik Poosa @ 2024-03-23 10:53 UTC (permalink / raw)
  To: intel-xe; +Cc: anshuman.gupta, badal.nilawar, Karthik Poosa

Add a NULL pointer check.

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@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) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] drm/xe: Fix static analysis tool reported errors
@ 2024-03-23  4:48 Karthik Poosa
  2024-03-23  5:07 ` Nilawar, Badal
  0 siblings, 1 reply; 21+ messages in thread
From: Karthik Poosa @ 2024-03-23  4:48 UTC (permalink / raw)
  To: intel-xe; +Cc: anshuman.gupta, badal.nilawar, Karthik Poosa

Add a NULL pointer check.
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@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) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-03-25 13:55 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25  8:05 [PATCH] drm/xe: Fix static analysis tool reported errors Karthik Poosa
2024-03-25  8:01 ` ✓ CI.Patch_applied: success for drm/xe: Fix static analysis tool reported errors (rev5) Patchwork
2024-03-25  8:01 ` ✓ CI.checkpatch: " Patchwork
2024-03-25  8:02 ` ✓ CI.KUnit: " Patchwork
2024-03-25  8:27 ` ✓ CI.Build: " Patchwork
2024-03-25  8:30 ` ✓ CI.Hooks: " Patchwork
2024-03-25  8:31 ` ✓ CI.checksparse: " Patchwork
2024-03-25  8:56 ` ✓ CI.BAT: " Patchwork
2024-03-25  9:44 ` [PATCH] drm/xe: Fix static analysis tool reported errors Jani Nikula
2024-03-25  9:45   ` Jani Nikula
2024-03-25 12:00 ` Riana Tauro
2024-03-25 13:29 ` Nilawar, Badal
2024-03-25 13:39   ` Poosa, Karthik
2024-03-25 13:55     ` Poosa, Karthik
  -- strict thread matches above, loose matches on Subject: below --
2024-03-25  3:53 Karthik Poosa
2024-03-25  6:18 ` Riana Tauro
2024-03-23 12:13 Karthik Poosa
2024-03-23 10:53 Karthik Poosa
2024-03-24  4:00 ` Gupta, Anshuman
2024-03-23  4:48 Karthik Poosa
2024-03-23  5:07 ` Nilawar, Badal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox