tee: optee: add missing mutext_destroy in optee_ffa_probe
authorDongliang Mu <mudongliangabcd@gmail.com>
Wed, 16 Mar 2022 13:50:47 +0000 (21:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:16:17 +0000 (09:16 +0200)
[ Upstream commit b5e22886839ae466fcf03295150094516c0fd8eb ]

The error handling code of optee_ffa_probe misses the mutex_destroy of
ffa.mutex when mutext_init succeeds.

Fix this by adding mutex_destory of ffa.mutex at the error handling part

Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tee/optee/ffa_abi.c

index f744ab15bf2c6ec77c507366a26be85de216c1e6..30a6119a2b16ad4e81b5986b7ae90a46827f45eb 100644 (file)
@@ -894,6 +894,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
        rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL);
        optee_supp_uninit(&optee->supp);
        mutex_destroy(&optee->call_queue.mutex);
+       mutex_destroy(&optee->ffa.mutex);
 err_unreg_supp_teedev:
        tee_device_unregister(optee->supp_teedev);
 err_unreg_teedev: