From 30d1e1e8208b91cd67fbe2138af396f19442cf05 Mon Sep 17 00:00:00 2001 From: Sven-Ola Tuecke Date: Tue, 3 Feb 2026 15:49:29 +0100 Subject: [PATCH] Spacemit: prevent uninitialized thread shutdown Signed-off-by: Sven-Ola Tuecke --- drivers/remoteproc/k1x-rproc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/k1x-rproc.c b/drivers/remoteproc/k1x-rproc.c index f3548e6da..a56d75f2a 100644 --- a/drivers/remoteproc/k1x-rproc.c +++ b/drivers/remoteproc/k1x-rproc.c @@ -633,7 +633,7 @@ static void spacemit_rproc_remove(struct platform_device *pdev) struct spacemit_rproc *ddata = rproc->priv; for (i = 0; i < MAX_MBOX; ++i) - if (ddata->mb[i].kthread_running) + if (ddata->mb[i].kthread_running && ddata->mb[i].mb_thread) kthread_stop(ddata->mb[i].mb_thread); rproc_del(rproc); @@ -664,7 +664,8 @@ static void spacemit_rproc_shutdown(struct platform_device *pdev) for (i = 0; i < MAX_MBOX; ++i) { /* release the resource of rt thread */ - kthread_stop(priv->mb[i].mb_thread); + if (priv->mb[i].kthread_running && priv->mb[i].mb_thread) + kthread_stop(priv->mb[i].mb_thread); /* mbox_free_channel(priv->mb[i].chan); */ } } -- 2.34.1