diff options
author | Rijo Thomas <Rijo-john.Thomas@amd.com> | 2020-01-09 18:23:20 +0530 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-01-16 15:18:13 +0800 |
commit | 2929015535fa355f604564ae5e542fd3c9179410 (patch) | |
tree | 5db3f8efd6051b57b7cd534d3dc6b241c0e8b131 /drivers/tee/amdtee | |
parent | f4c58c3758f95eec5ea9cf1424d68350f00f9eb9 (diff) | |
download | linux-2929015535fa355f604564ae5e542fd3c9179410.tar.bz2 |
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>
Diffstat (limited to 'drivers/tee/amdtee')
-rw-r--r-- | drivers/tee/amdtee/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c index 0840be03a3ab..c657b9728eae 100644 --- a/drivers/tee/amdtee/core.c +++ b/drivers/tee/amdtee/core.c @@ -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); |