tpm/tpm_ftpm_tee: Fix error handling in ftpm_mod_init()
authorYuan Can <yuancan@huawei.com>
Thu, 24 Nov 2022 03:19:26 +0000 (03:19 +0000)
committerJarkko Sakkinen <jarkko@kernel.org>
Thu, 8 Dec 2022 16:20:47 +0000 (16:20 +0000)
commit2b7d07f7acaac2c7750e420dcf4414588ede6d03
treecb5ede57af81d7f1eb7ee003f34b3e36ea0396b4
parentdb9622f762104459ff87ecdf885cc42c18053fd9
tpm/tpm_ftpm_tee: Fix error handling in ftpm_mod_init()

The ftpm_mod_init() returns the driver_register() directly without checking
its return value, if driver_register() failed, the ftpm_tee_plat_driver is
not unregistered.

Fix by unregister ftpm_tee_plat_driver when driver_register() failed.

Fixes: 9f1944c23c8c ("tpm_ftpm_tee: register driver on TEE bus")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm_ftpm_tee.c