diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index dd46b758852aa..d42fc2ae8592e 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -96,8 +96,10 @@ void teedev_ctx_put(struct tee_context *ctx) static void teedev_close_context(struct tee_context *ctx) { - tee_device_put(ctx->teedev); + struct tee_device *teedev = ctx->teedev; + teedev_ctx_put(ctx); + tee_device_put(teedev); } static int tee_release(struct inode *inode, struct file *filp)