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>
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;
err:
tee_device_unregister(amdtee->teedev);
+
+err_free_pool:
if (pool)
tee_shm_pool_free(pool);