Re: [PATCH] firmware: qcom: scm: Use __cleanup() for device_node pointers

From: Krzysztof Kozlowski
Date: Tue Nov 18 2025 - 06:45:08 EST


On 17/11/2025 17:22, Kathiravan Thirumoorthy wrote:
> Make use of the __cleanup() attribute for device_node pointers to simplify
> resource management and remove explicit of_node_put() calls.
>
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@xxxxxxxxxxxxxxxx>
> ---
> drivers/firmware/qcom/qcom_scm.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index e777b7cb9b127944fe112f453cae9cbc40c06cae..7c1fffa8e7ad48b294b90e7e63f726d0ba7d55e1 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
> @@ -1746,7 +1746,7 @@ EXPORT_SYMBOL_GPL(qcom_scm_gpu_init_regs);
>
> static int qcom_scm_find_dload_address(struct device *dev, u64 *addr)
> {
> - struct device_node *tcsr;
> + struct device_node *tcsr __free(device_node) = NULL;


NAK.

This is wrong syntax. This must come with constructor.

Don't use cleanup.h if you do not understand its syntax. You just lead
to worse code and encourage bugs.

Best regards,
Krzysztof