[PATCH] drm/amd/ras: use proper error checking for kthread_run return

From: Miaoqian Lin

Date: Sat Jan 10 2026 - 11:48:12 EST


kthread_run() returns an error pointer on failure, not NULL.
Replace NULL check with IS_ERR and use PTR_ERR to
propagate the real error from kthread_run.

Fixes: ea61341b9014 ("drm/amd/ras: Add thread to handle ras events")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
---
drivers/gpu/drm/amd/ras/rascore/ras_process.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/ras/rascore/ras_process.c b/drivers/gpu/drm/amd/ras/rascore/ras_process.c
index 3267dcdb169c..c001074c8c56 100644
--- a/drivers/gpu/drm/amd/ras/rascore/ras_process.c
+++ b/drivers/gpu/drm/amd/ras/rascore/ras_process.c
@@ -248,9 +248,10 @@ int ras_process_init(struct ras_core_context *ras_core)

ras_proc->ras_process_thread = kthread_run(ras_process_thread,
(void *)ras_core, "ras_process_thread");
- if (!ras_proc->ras_process_thread) {
+ if (IS_ERR(ras_proc->ras_process_thread)) {
RAS_DEV_ERR(ras_core->dev, "Failed to create ras_process_thread.\n");
- ret = -ENOMEM;
+ ret = PTR_ERR(ras_proc->ras_process_thread);
+ ras_proc->ras_process_thread = NULL;
goto err;
}

--
2.39.5 (Apple Git-154)