From: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
Jens Wiklander <jens.wiklander@linaro.org>,
Sumit Garg <sumit.garg@kernel.org>,
linux-arm-msm@vger.kernel.org, op-tee@lists.trustedfirmware.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] tee: qcomtee: user: Fix confusing cleanup.h syntax
Date: Mon, 5 Jan 2026 09:50:23 +1100 [thread overview]
Message-ID: <eca4b7b7-d4de-4209-9965-4a8ce027caee@oss.qualcomm.com> (raw)
In-Reply-To: <20251208020844.5310-6-krzysztof.kozlowski@oss.qualcomm.com>
On 12/8/2025 1:08 PM, Krzysztof Kozlowski wrote:
> Initializing automatic __free variables to NULL without need (e.g.
> branches with different allocations), followed by actual allocation is
> in contrary to explicit coding rules guiding cleanup.h:
>
> "Given that the "__free(...) = NULL" pattern for variables defined at
> the top of the function poses this potential interdependency problem the
> recommendation is to always define and assign variables in one statement
> and not group variable definitions at the top of the function when
> __free() is used."
>
> Code does not have a bug, but is less readable and uses discouraged
> coding practice, so fix that by moving declaration to the place of
> assignment.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
> drivers/tee/qcomtee/user_obj.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tee/qcomtee/user_obj.c b/drivers/tee/qcomtee/user_obj.c
> index 0139905f2684..6aa3aefd67f0 100644
> --- a/drivers/tee/qcomtee/user_obj.c
> +++ b/drivers/tee/qcomtee/user_obj.c
> @@ -228,10 +228,10 @@ static int qcomtee_user_object_dispatch(struct qcomtee_object_invoke_ctx *oic,
> {
> struct qcomtee_user_object *uo = to_qcomtee_user_object(object);
> struct qcomtee_context_data *ctxdata = uo->ctx->data;
> - struct qcomtee_ureq *ureq __free(kfree) = NULL;
> int errno;
>
> - ureq = kzalloc(sizeof(*ureq), GFP_KERNEL);
> + struct qcomtee_ureq *ureq __free(kfree) = kzalloc(sizeof(*ureq),
> + GFP_KERNEL);
> if (!ureq)
> return -ENOMEM;
>
> @@ -367,10 +367,10 @@ int qcomtee_user_param_to_object(struct qcomtee_object **object,
> struct tee_param *param,
> struct tee_context *ctx)
> {
> - struct qcomtee_user_object *user_object __free(kfree) = NULL;
> int err;
>
> - user_object = kzalloc(sizeof(*user_object), GFP_KERNEL);
> + struct qcomtee_user_object *user_object __free(kfree) =
> + kzalloc(sizeof(*user_object), GFP_KERNEL);
> if (!user_object)
> return -ENOMEM;
>
Reviewed-by: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
- Amir
next prev parent reply other threads:[~2026-01-04 22:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 2:08 [PATCH 1/3] tee: qcomtee: call: Fix confusing cleanup.h syntax Krzysztof Kozlowski
2025-12-08 2:08 ` [PATCH 2/3] tee: qcomtee: mem: " Krzysztof Kozlowski
2026-01-04 22:48 ` Amirreza Zarrabi
2025-12-08 2:08 ` [PATCH 3/3] tee: qcomtee: user: " Krzysztof Kozlowski
2026-01-04 22:50 ` Amirreza Zarrabi [this message]
2026-01-05 10:45 ` Jens Wiklander
2025-12-12 0:55 ` [PATCH 1/3] tee: qcomtee: call: " Sumit Garg
2025-12-12 1:07 ` Krzysztof Kozlowski
2025-12-12 1:39 ` Sumit Garg
2025-12-15 20:29 ` Amirreza Zarrabi
2025-12-16 7:33 ` Jens Wiklander
2026-01-04 21:42 ` Amirreza Zarrabi
2025-12-15 23:11 ` Jeff Johnson
2026-01-04 22:42 ` Amirreza Zarrabi
2026-01-05 10:44 ` Jens Wiklander
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=eca4b7b7-d4de-4209-9965-4a8ce027caee@oss.qualcomm.com \
--to=amirreza.zarrabi@oss.qualcomm.com \
--cc=jens.wiklander@linaro.org \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=sumit.garg@kernel.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