Skip to contentSkip to conversation

drm/amdgpu: fix drm panic null pointer when driver not support atomic

PATCH Applied [email protected] 2 participants 2 messages Jan 6

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix drm panic null pointer when driver not support atomic

From: Lu Yao <[email protected]>

When driver not support atomic, fb using plane->fb rather than plane->state->fb.

Fixes fe151ed7af54 ("drm/amdgpu: add generic display panic helper code")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +6 -1
index b5d34797d606..52bc04452812 100644
@@ -1880,7 +1880,12 @@ int amdgpu_display_get_scanout_buffer(struct drm_plane *plane,
 				      struct drm_scanout_buffer *sb)
 {
 	struct amdgpu_bo *abo;
-	struct drm_framebuffer *fb = plane->state->fb;
+	struct drm_framebuffer *fb;
+
+	if (drm_drv_uses_atomic_modeset(plane->dev))
+		fb = plane->state->fb;
+	else
+		fb = plane->fb;
 
 	if (!fb)
 		return -EINVAL;
Signature · 1 line
2.25.1
Applied
#1 lore raw

Applied. Thanks!

Quoted 33 lines · On Mon, Jan 5, 2026 at 9:37 PM <[email protected]> wrote:

From: Lu Yao <[email protected]>

When driver not support atomic, fb using plane->fb rather than plane->state->fb.

Fixes fe151ed7af54 ("drm/amdgpu: add generic display panic helper code")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +6 -2
index b5d34797d606..52bc04452812 100644
@@ -1880,7 +1880,12 @@ int amdgpu_display_get_scanout_buffer(struct drm_plane *plane,
                                      struct drm_scanout_buffer *sb)
 {
        struct amdgpu_bo *abo;
-       struct drm_framebuffer *fb = plane->state->fb;
+       struct drm_framebuffer *fb;
+
+       if (drm_drv_uses_atomic_modeset(plane->dev))
+               fb = plane->state->fb;
+       else
+               fb = plane->fb;
 
        if (!fb)
                return -EINVAL;
--

2.25.1