From: Rijo Thomas <Rijo-john.Thomas@amd.com>
To: Jens Wiklander <jens.wiklander@linaro.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Gary R Hook <gary.hook@amd.com>,
tee-dev@lists.linaro.org, linux-kernel@vger.kernel.org,
linux-crypto@vger.kernel.org
Cc: Rijo Thomas <Rijo-john.Thomas@amd.com>,
Nimesh Easow <Nimesh.Easow@amd.com>,
Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH 3/5] tee: amdtee: skip tee_device_unregister if tee_device_alloc fails
Date: Thu, 9 Jan 2020 18:23:20 +0530 [thread overview]
Message-ID: <845049bc920b6873f58f3e8d04514248e73f77c9.1578572591.git.Rijo-john.Thomas@amd.com> (raw)
In-Reply-To: <cover.1578572591.git.Rijo-john.Thomas@amd.com>
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>
---
drivers/tee/amdtee/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
2.17.1
next prev parent reply other threads:[~2020-01-09 12:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-09 12:53 [PATCH 0/5] amdtee: Address bug report Rijo Thomas
2020-01-09 12:53 ` [PATCH 1/5] tee: amdtee: remove unused variable initialization Rijo Thomas
2020-01-09 12:53 ` [PATCH 2/5] tee: amdtee: print error message if tee not present Rijo Thomas
2020-01-09 12:53 ` Rijo Thomas [this message]
2020-01-09 12:53 ` [PATCH 4/5] tee: amdtee: rename err label to err_device_unregister Rijo Thomas
2020-01-09 12:53 ` [PATCH 5/5] tee: amdtee: remove redundant NULL check for pool Rijo Thomas
2020-01-09 16:14 ` [PATCH 0/5] amdtee: Address bug report Dan Carpenter
2020-01-16 7:29 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=845049bc920b6873f58f3e8d04514248e73f77c9.1578572591.git.Rijo-john.Thomas@amd.com \
--to=rijo-john.thomas@amd.com \
--cc=Devaraj.Rangasamy@amd.com \
--cc=Nimesh.Easow@amd.com \
--cc=dan.carpenter@oracle.com \
--cc=gary.hook@amd.com \
--cc=herbert@gondor.apana.org.au \
--cc=jens.wiklander@linaro.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tee-dev@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®