|
| 1 | +From 30d1e1e8208b91cd67fbe2138af396f19442cf05 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Sven-Ola Tuecke <sven-ola@gmx.de> |
| 3 | +Date: Tue, 3 Feb 2026 15:49:29 +0100 |
| 4 | +Subject: [PATCH] Spacemit: prevent uninitialized thread shutdown |
| 5 | + |
| 6 | +Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de> |
| 7 | +--- |
| 8 | + drivers/remoteproc/k1x-rproc.c | 5 +++-- |
| 9 | + 1 file changed, 3 insertions(+), 2 deletions(-) |
| 10 | + |
| 11 | +diff --git a/drivers/remoteproc/k1x-rproc.c b/drivers/remoteproc/k1x-rproc.c |
| 12 | +index f3548e6da..a56d75f2a 100644 |
| 13 | +--- a/drivers/remoteproc/k1x-rproc.c |
| 14 | ++++ b/drivers/remoteproc/k1x-rproc.c |
| 15 | +@@ -633,7 +633,7 @@ static void spacemit_rproc_remove(struct platform_device *pdev) |
| 16 | + struct spacemit_rproc *ddata = rproc->priv; |
| 17 | + |
| 18 | + for (i = 0; i < MAX_MBOX; ++i) |
| 19 | +- if (ddata->mb[i].kthread_running) |
| 20 | ++ if (ddata->mb[i].kthread_running && ddata->mb[i].mb_thread) |
| 21 | + kthread_stop(ddata->mb[i].mb_thread); |
| 22 | + |
| 23 | + rproc_del(rproc); |
| 24 | +@@ -664,7 +664,8 @@ static void spacemit_rproc_shutdown(struct platform_device *pdev) |
| 25 | + |
| 26 | + for (i = 0; i < MAX_MBOX; ++i) { |
| 27 | + /* release the resource of rt thread */ |
| 28 | +- kthread_stop(priv->mb[i].mb_thread); |
| 29 | ++ if (priv->mb[i].kthread_running && priv->mb[i].mb_thread) |
| 30 | ++ kthread_stop(priv->mb[i].mb_thread); |
| 31 | + /* mbox_free_channel(priv->mb[i].chan); */ |
| 32 | + } |
| 33 | + } |
| 34 | +-- |
| 35 | +2.34.1 |
| 36 | + |
0 commit comments