Re: [PATCH 2/2] drm/panic: Accept a trailing newline in panic_screen

From: Tvrtko Ursulin

Date: Fri Oct 16 2026 - 03:51:23 EST



On 16/10/2026 06:27, Devin Wittmayer wrote:
Setting the panic screen through sysfs with echo fails with EINVAL,
because the value ends in a newline. Ignore it when matching.

Fixes: e85e9ccf3f84 ("drm/panic: Report invalid or unsupported panic modes")
Signed-off-by: Devin Wittmayer <lucid_duck@xxxxxxxxxxxxx>
---
QEMU, 10 runs each, on drm-misc-fixes and drm-misc-next:

before after
write of "user\n" refused takes
write of "bsod\n" refused refused

Hah funny, becuase before e85e9ccf3f84 it used to take "bsod\n" but AFAIR it would silently revert to displaying "user". Because old code was this:

static void draw_panic_dispatch(struct drm_scanout_buffer *sb)
{
if (!strcmp(drm_panic_screen, "kmsg")) {
draw_panic_static_kmsg(sb);
} else if (!strcmp(drm_panic_screen, "qr_code")) {
draw_panic_static_qr_code(sb);
} else {
draw_panic_static_user(sb);
}
}

But it is true that it would also silently accept "user\n" so I guess you can call it a partial regression.

Anyway, the fix LGTM.

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxx>

Regards,

Tvrtko

drm.panic_screen=user at boot takes takes

amdgpu, 2 runs each, 7.2.6 with Arch's source and config:

echo user refused takes

drivers/gpu/drm/drm_panic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
index 29b1487de7ae0..7847b38ba9aab 100644
--- a/drivers/gpu/drm/drm_panic.c
+++ b/drivers/gpu/drm/drm_panic.c
@@ -839,7 +839,7 @@ static int drm_panic_type_set(const char *val, const struct kernel_param *kp)
unsigned int i;
for (i = 0; i < ARRAY_SIZE(drm_panic_type_map); i++) {
- if (!strcmp(val, drm_panic_type_map[i])) {
+ if (sysfs_streq(val, drm_panic_type_map[i])) {
drm_panic_type = i;
return 0;
}