2022-01-08 09:59:41

by Miaoqian Lin

[permalink] [raw]
Subject: [PATCH] soc: qcom: aoss: Fix missing put_device call in qmp_get

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling paths.

Fixes: 8c75d585b931 ("soc: qcom: aoss: Expose send for generic usecase")
Signed-off-by: Miaoqian Lin <[email protected]>
---
drivers/soc/qcom/qcom_aoss.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
index 34acf58bbb0d..e234d78b33e7 100644
--- a/drivers/soc/qcom/qcom_aoss.c
+++ b/drivers/soc/qcom/qcom_aoss.c
@@ -451,7 +451,11 @@ struct qmp *qmp_get(struct device *dev)

qmp = platform_get_drvdata(pdev);

- return qmp ? qmp : ERR_PTR(-EPROBE_DEFER);
+ if (!qmp) {
+ put_device(&pdev->dev);
+ return ERR_PTR(-EPROBE_DEFER);
+ }
+ return qmp;
}
EXPORT_SYMBOL(qmp_get);

--
2.17.1



2022-01-10 21:12:11

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] soc: qcom: aoss: Fix missing put_device call in qmp_get

Quoting Miaoqian Lin (2022-01-08 01:59:31)
> The reference taken by 'of_find_device_by_node()' must be released when
> not needed anymore.
> Add the corresponding 'put_device()' in the error handling paths.
>
> Fixes: 8c75d585b931 ("soc: qcom: aoss: Expose send for generic usecase")
> Signed-off-by: Miaoqian Lin <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2022-02-06 13:00:53

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH] soc: qcom: aoss: Fix missing put_device call in qmp_get

On Sat, 8 Jan 2022 09:59:31 +0000, Miaoqian Lin wrote:
> The reference taken by 'of_find_device_by_node()' must be released when
> not needed anymore.
> Add the corresponding 'put_device()' in the error handling paths.
>
>

Applied, thanks!

[1/1] soc: qcom: aoss: Fix missing put_device call in qmp_get
commit: 4b41a9d0fe3db5f91078a380f62f0572c3ecf2dd

Best regards,
--
Bjorn Andersson <[email protected]>