Re: [PATCH 1/4] firmware: qcom: tzmem: guard against IS_ERR() in the cleanup handler
From: Mukesh Ojha
Date: Thu Jul 02 2026 - 04:16:01 EST
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@xxxxxxxxxxxxxxxx>
> ---
> 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?
>
> phys_addr_t qcom_tzmem_to_phys(void *ptr);
>
>
> --
> 2.47.3
>
--
-Mukesh Ojha