mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
tee: amdtee: skip tee_device_unregister if tee_device_alloc fails
Currently, if tee_device_alloc() fails, then tee_device_unregister() is a no-op. Therefore, skip the function call to tee_device_unregister() by introducing a new goto label 'err_free_pool'. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
f4c58c3758
commit
2929015535
@ -465,7 +465,7 @@ static int __init amdtee_driver_init(void)
|
||||
teedev = tee_device_alloc(&amdtee_desc, NULL, pool, amdtee);
|
||||
if (IS_ERR(teedev)) {
|
||||
rc = PTR_ERR(teedev);
|
||||
goto err;
|
||||
goto err_free_pool;
|
||||
}
|
||||
amdtee->teedev = teedev;
|
||||
|
||||
@ -482,6 +482,8 @@ static int __init amdtee_driver_init(void)
|
||||
|
||||
err:
|
||||
tee_device_unregister(amdtee->teedev);
|
||||
|
||||
err_free_pool:
|
||||
if (pool)
|
||||
tee_shm_pool_free(pool);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user