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 <[email protected]>
> ---
>  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

Reply via email to