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

From: Jocelyn Falempe

Date: Fri Oct 16 2026 - 17:22:11 EST


On 10/16/26 07: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.

Thanks it looks good to me.

Reviewed-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx>

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
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;
}