diff mbox series

[1/2] Bluetooth: btbcm: fix missing of_node_put() in btbcm_get_board_name()

Message ID 20241030-bluetooth-btbcm-node-cleanup-v1-1-fdc4b9df9fe3@gmail.com (mailing list archive)
State Superseded
Headers show
Series Bluetooth: btbcm: fix missing of_node_put() in btbcm_get_board_name() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS

Commit Message

Javier Carrasco Oct. 30, 2024, 3:46 p.m. UTC
Add the missing call lto of_node_put(root) in the early return to
decrement the refcount and avoid leaking the resource.

Cc: stable@vger.kernel.org
Fixes: 63fac3343b99 ("Bluetooth: btbcm: Support per-board firmware variants")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/bluetooth/btbcm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index eef00467905e..400c2663d6b0 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -549,8 +549,10 @@  static const char *btbcm_get_board_name(struct device *dev)
 	if (!root)
 		return NULL;
 
-	if (of_property_read_string_index(root, "compatible", 0, &tmp))
+	if (of_property_read_string_index(root, "compatible", 0, &tmp)) {
+		of_node_put(root);
 		return NULL;
+	}
 
 	/* get rid of any '/' in the compatible string */
 	board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);