[PATCH v2] crypto: inside-secure: initialize EIP93 state before requesting IRQ

From: Runyu Xiao

Date: Thu Oct 08 2026 - 23:33:23 EST


devm_request_threaded_irq() can invoke the handler as soon as registration
starts. Initialize EIP93 state before requesting it and leave device
interrupts disabled until registration succeeds.

If IRQ registration fails after the hardware and rings are initialized,
call eip93_cleanup() before returning. This shuts down the engine and
clears the ring registers before devres releases the DMA rings.

Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
---
Changes in v2:
- Call eip93_cleanup() if IRQ registration fails after device initialization.

drivers/crypto/inside-secure/eip93/eip93-main.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/inside-secure/eip93/eip93-main.c b/drivers/crypto/inside-secure/eip93/eip93-main.c
index e62785952b..52b5fb1ffc 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-main.c
+++ b/drivers/crypto/inside-secure/eip93/eip93-main.c
@@ -430,12 +430,6 @@ static int eip93_crypto_probe(struct platform_device *pdev)
if (eip93->irq < 0)
return eip93->irq;

- ret = devm_request_threaded_irq(eip93->dev, eip93->irq, eip93_irq_handler,
- NULL, IRQF_ONESHOT,
- dev_name(eip93->dev), eip93);
- if (ret)
- return ret;
-
ret = eip93_desc_init(eip93);
if (ret)
return ret;
@@ -452,6 +446,14 @@ static int eip93_crypto_probe(struct platform_device *pdev)

eip93_initialize(eip93, algo_flags);

+ ret = devm_request_threaded_irq(eip93->dev, eip93->irq, eip93_irq_handler,
+ NULL, IRQF_ONESHOT,
+ dev_name(eip93->dev), eip93);
+ if (ret) {
+ eip93_cleanup(eip93);
+ return ret;
+ }
+
/* Init finished, enable RDR interrupt */
eip93_irq_enable(eip93, EIP93_INT_RDR_THRESH);