From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: Bartosz Golaszewski <brgl@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] firmware: qcom: tzmem: guard against IS_ERR() in the cleanup handler
Date: Thu, 2 Jul 2026 12:04:13 +0200 [thread overview]
Message-ID: <82b28f9d-029a-4b5c-852c-7ae74b1ff83f@oss.qualcomm.com> (raw)
In-Reply-To: <20260702081026.c7rzopcn7vypggjq@hu-mojha-hyd.qualcomm.com>
On 7/2/26 10:10 AM, Mukesh Ojha wrote:
> On Wed, Jul 01, 2026 at 03:38:55PM +0200, Bartosz Golaszewski wrote:
>> We currently only silently skip NULL-pointers in the cleanup handler for
>> tzmem. It's possible that we get passed a pointer holding an ERR_PTR()
>> value so skip it too.
>>
>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>> ---
>> include/linux/firmware/qcom/qcom_tzmem.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/firmware/qcom/qcom_tzmem.h b/include/linux/firmware/qcom/qcom_tzmem.h
>> index 23173e0c3dddd154dd56dc3dcb56bd20ada0520a..b5520178bf6f53b86b530571a3be9f302225f022 100644
>> --- a/include/linux/firmware/qcom/qcom_tzmem.h
>> +++ b/include/linux/firmware/qcom/qcom_tzmem.h
>> @@ -58,7 +58,7 @@ devm_qcom_tzmem_pool_new(struct device *dev,
>> void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp);
>> void qcom_tzmem_free(void *ptr);
>>
>> -DEFINE_FREE(qcom_tzmem, void *, if (_T) qcom_tzmem_free(_T))
>> +DEFINE_FREE(qcom_tzmem, void *, if (!IS_ERR_OR_NULL(_T)) qcom_tzmem_free(_T))
>
> Is this really required? Are we trying to address an issue which
> does not exist today?
It doesn't, I was scratching my head too, but in patch 2 there's:
void *output_rt_tzm __free(qcom_tzmem) =
__qcom_scm_pas_get_rsc_table(ctx->pas_id, input_rt_tzm,
input_rt_size, &size);
and __qcom_scm_pas_get_rsc_table() does throw ERR_PTRs
Konrad
next prev parent reply other threads:[~2026-07-02 10:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 13:38 [PATCH 0/4] firmware: qcom: scm: simplify code by using classes Bartosz Golaszewski
2026-07-01 13:38 ` [PATCH 1/4] firmware: qcom: tzmem: guard against IS_ERR() in the cleanup handler Bartosz Golaszewski
2026-07-02 8:10 ` Mukesh Ojha
2026-07-02 9:47 ` Bartosz Golaszewski
2026-07-02 10:24 ` Mukesh Ojha
2026-07-02 10:04 ` Konrad Dybcio [this message]
2026-07-02 10:53 ` Konrad Dybcio
2026-07-01 13:38 ` [PATCH 2/4] firmware: qcom: scm: use __free(qcom_tzmem) to simplify cleanup Bartosz Golaszewski
2026-07-02 8:24 ` Mukesh Ojha
2026-07-02 9:54 ` Konrad Dybcio
2026-07-01 13:38 ` [PATCH 3/4] firmware: qcom: scm: introduce qcom_scm_clk class for clock management Bartosz Golaszewski
2026-07-02 8:41 ` Mukesh Ojha
2026-07-02 9:58 ` Konrad Dybcio
2026-07-01 13:38 ` [PATCH 4/4] firmware: qcom: scm: introduce qcom_scm_bw class for bandwidth management Bartosz Golaszewski
2026-07-02 8:38 ` Mukesh Ojha
2026-07-02 9:59 ` Konrad Dybcio
2026-07-30 21:04 ` [PATCH 0/4] firmware: qcom: scm: simplify code by using classes Bjorn Andersson
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=82b28f9d-029a-4b5c-852c-7ae74b1ff83f@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.ojha@oss.qualcomm.com \
/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®