* [PATCH] remoteproc: qcom: q6v5: Release QMP handle on ICC path failure
@ 2026-06-23 13:20 Haoxiang Li
2026-06-23 16:01 ` Mukesh Ojha
0 siblings, 1 reply; 3+ messages in thread
From: Haoxiang Li @ 2026-06-23 13:20 UTC (permalink / raw)
To: andersson, mathieu.poirier, djakov
Cc: linux-arm-msm, linux-remoteproc, linux-kernel, Haoxiang Li
qcom_q6v5_init() acquires the QMP handle before getting the
interconnect path. If devm_of_icc_get() fails, the function
returns without releasing the QMP handle, leaking the device
reference acquired by qmp_get().
Release the QMP handle on the interconnect error path before returning.
Fixes: 8d9be5c6bdcd ("remoteproc: qcom: q6v5: Add interconnect path proxy vote")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
drivers/remoteproc/qcom_q6v5.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
index 58d5b85e58cd..b57041a37d28 100644
--- a/drivers/remoteproc/qcom_q6v5.c
+++ b/drivers/remoteproc/qcom_q6v5.c
@@ -347,9 +347,11 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
}
q6v5->path = devm_of_icc_get(&pdev->dev, NULL);
- if (IS_ERR(q6v5->path))
+ if (IS_ERR(q6v5->path)) {
+ qmp_put(q6v5->qmp);
return dev_err_probe(&pdev->dev, PTR_ERR(q6v5->path),
"failed to acquire interconnect path\n");
+ }
return 0;
}
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc: qcom: q6v5: Release QMP handle on ICC path failure
2026-06-23 13:20 [PATCH] remoteproc: qcom: q6v5: Release QMP handle on ICC path failure Haoxiang Li
@ 2026-06-23 16:01 ` Mukesh Ojha
2026-06-23 16:11 ` Konrad Dybcio
0 siblings, 1 reply; 3+ messages in thread
From: Mukesh Ojha @ 2026-06-23 16:01 UTC (permalink / raw)
To: Haoxiang Li
Cc: andersson, mathieu.poirier, djakov, linux-arm-msm,
linux-remoteproc, linux-kernel
On Tue, Jun 23, 2026 at 09:20:15PM +0800, Haoxiang Li wrote:
> qcom_q6v5_init() acquires the QMP handle before getting the
> interconnect path. If devm_of_icc_get() fails, the function
> returns without releasing the QMP handle, leaking the device
> reference acquired by qmp_get().
>
> Release the QMP handle on the interconnect error path before returning.
>
> Fixes: 8d9be5c6bdcd ("remoteproc: qcom: q6v5: Add interconnect path proxy vote")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> drivers/remoteproc/qcom_q6v5.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
> index 58d5b85e58cd..b57041a37d28 100644
> --- a/drivers/remoteproc/qcom_q6v5.c
> +++ b/drivers/remoteproc/qcom_q6v5.c
> @@ -347,9 +347,11 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
> }
>
> q6v5->path = devm_of_icc_get(&pdev->dev, NULL);
> - if (IS_ERR(q6v5->path))
> + if (IS_ERR(q6v5->path)) {
> + qmp_put(q6v5->qmp);
> return dev_err_probe(&pdev->dev, PTR_ERR(q6v5->path),
> "failed to acquire interconnect path\n");
> + }
I would have preferred to move devm_of_icc_get before qmp_get()
--- a/drivers/remoteproc/qcom_q6v5.c
+++ b/drivers/remoteproc/qcom_q6v5.c
@@ -331,6 +331,11 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
return PTR_ERR(q6v5->state);
}
+ q6v5->path = devm_of_icc_get(&pdev->dev, NULL);
+ if (IS_ERR(q6v5->path))
+ return dev_err_probe(&pdev->dev, PTR_ERR(q6v5->path),
+ "failed to acquire interconnect path\n");
+
q6v5->load_state = devm_kstrdup_const(&pdev->dev, load_state, GFP_KERNEL);
q6v5->qmp = qmp_get(&pdev->dev);
if (IS_ERR(q6v5->qmp)) {
@@ -346,11 +351,6 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
return load_state ? -ENOMEM : -EINVAL;
}
- q6v5->path = devm_of_icc_get(&pdev->dev, NULL);
- if (IS_ERR(q6v5->path))
- return dev_err_probe(&pdev->dev, PTR_ERR(q6v5->path),
- "failed to acquire interconnect path\n");
-
return 0;
>
> return 0;
> }
> --
> 2.25.1
>
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc: qcom: q6v5: Release QMP handle on ICC path failure
2026-06-23 16:01 ` Mukesh Ojha
@ 2026-06-23 16:11 ` Konrad Dybcio
0 siblings, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2026-06-23 16:11 UTC (permalink / raw)
To: Mukesh Ojha, Haoxiang Li
Cc: andersson, mathieu.poirier, djakov, linux-arm-msm,
linux-remoteproc, linux-kernel
On 6/23/26 6:01 PM, Mukesh Ojha wrote:
> On Tue, Jun 23, 2026 at 09:20:15PM +0800, Haoxiang Li wrote:
>> qcom_q6v5_init() acquires the QMP handle before getting the
>> interconnect path. If devm_of_icc_get() fails, the function
>> returns without releasing the QMP handle, leaking the device
>> reference acquired by qmp_get().
>>
>> Release the QMP handle on the interconnect error path before returning.
>>
>> Fixes: 8d9be5c6bdcd ("remoteproc: qcom: q6v5: Add interconnect path proxy vote")
>> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
>> ---
>> drivers/remoteproc/qcom_q6v5.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
>> index 58d5b85e58cd..b57041a37d28 100644
>> --- a/drivers/remoteproc/qcom_q6v5.c
>> +++ b/drivers/remoteproc/qcom_q6v5.c
>> @@ -347,9 +347,11 @@ int qcom_q6v5_init(struct qcom_q6v5 *q6v5, struct platform_device *pdev,
>> }
>>
>> q6v5->path = devm_of_icc_get(&pdev->dev, NULL);
>> - if (IS_ERR(q6v5->path))
>> + if (IS_ERR(q6v5->path)) {
>> + qmp_put(q6v5->qmp);
>> return dev_err_probe(&pdev->dev, PTR_ERR(q6v5->path),
>> "failed to acquire interconnect path\n");
>> + }
>
> I would have preferred to move devm_of_icc_get before qmp_get()
Yeah this saves on cleanup
Konrad
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-23 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-23 13:20 [PATCH] remoteproc: qcom: q6v5: Release QMP handle on ICC path failure Haoxiang Li
2026-06-23 16:01 ` Mukesh Ojha
2026-06-23 16:11 ` Konrad Dybcio
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®