Skip to contentSkip to conversation

soc: qcom: aoss: Fix missing put_device call in qmp_get

PATCH Applied Miaoqian Lin 3 participants 3 messages Jan 8, 2022 – Feb 4, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/soc/qcom/qcom_aoss.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/soc/qcom/qcom_aoss.c +5 -1
index 34acf58bbb0d..e234d78b33e7 100644
@@ -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);
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Quoting Miaoqian Lin (2022-01-08 01:59:31)

Quoted 7 lines

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")

---

#2 lore raw

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

In reply to Miaoqian Lin
Quoted 5 lines · Miaoqian Lin

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,

Signature · 1 line
Bjorn Andersson <[email protected]>