[PATCH v15 31/35] crypto: amlogic: clear algorithm pointers on unregister

From: Jose Nieto

Date: Wed Dec 02 2026 - 05:12:41 EST


meson_unregister_algs() left algs[i].mc set after unregistering. As the
algorithm templates are static, a later (re-)probe that fails partway
through meson_register_algs() could unregister entries that were never
registered, hitting a WARN_ON() in crypto_unregister_alg(). Clear
algs[i].mc once the algorithm is unregistered.

Signed-off-by: Jose Nieto <jnieto.alaber@xxxxxxxxx>
---
drivers/crypto/amlogic/amlogic-gxl-core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
index d11319425d5f..a464a8b76211 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-core.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
@@ -212,6 +212,7 @@ void meson_unregister_algs(struct meson_dev *mc, struct meson_alg_template *algs
crypto_engine_unregister_ahash(&algs[i].alg.ahash);
break;
}
+ algs[i].mc = NULL;
}
}

--
2.47.3