diff mbox series

remoteproc: qcom_q6v5_pas: fix refcount leak in adsp_alloc_memory_region()

Message ID 1670203687-42016-1-git-send-email-wangyufen@huawei.com (mailing list archive)
State New, archived
Headers show
Series remoteproc: qcom_q6v5_pas: fix refcount leak in adsp_alloc_memory_region() | expand

Commit Message

wangyufen Dec. 5, 2022, 1:28 a.m. UTC
The node returned by of_parse_phandle() with refcount incremented,
of_node_put() needs be called when finish using it. So add it in the
end of of_address_to_resource().

Fixes: 9e004f97161d ("remoteproc: qcom: Rename Hexagon v5 PAS driver")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 drivers/remoteproc/qcom_q6v5_pas.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Neil Armstrong Dec. 5, 2022, 8:21 a.m. UTC | #1
On 05/12/2022 02:28, Wang Yufen wrote:
> The node returned by of_parse_phandle() with refcount incremented,
> of_node_put() needs be called when finish using it. So add it in the
> end of of_address_to_resource().
> 
> Fixes: 9e004f97161d ("remoteproc: qcom: Rename Hexagon v5 PAS driver")
> Signed-off-by: Wang Yufen <wangyufen@huawei.com>
> ---
>   drivers/remoteproc/qcom_q6v5_pas.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 6afd094..24439a6 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -449,6 +449,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
>   	}
>   
>   	ret = of_address_to_resource(node, 0, &r);
> +	of_node_put(node);
>   	if (ret)
>   		return ret;
>   


Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
diff mbox series

Patch

diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 6afd094..24439a6 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -449,6 +449,7 @@  static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
 	}
 
 	ret = of_address_to_resource(node, 0, &r);
+	of_node_put(node);
 	if (ret)
 		return ret;