[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220906143412.123134-1-zhengyongjun3@huawei.com>
Date: Tue, 6 Sep 2022 14:34:12 +0000
From: Zheng Yongjun <zhengyongjun3@...wei.com>
To: <linux-bluetooth@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <marcel@...tmann.org>, <johan.hedberg@...il.com>,
<luiz.dentz@...il.com>
Subject: [PATCH -next] Bluetooth: btbcm: add missing of_node_put() in btbcm_get_board_name()
After using 'root' returned by of_find_node_by_path(), of_node_put()
need be called to decrease the refcount.
Fixes: 63fac3343b99 ("Bluetooth: btbcm: Support per-board firmware variants")
Signed-off-by: Zheng Yongjun <zhengyongjun3@...wei.com>
---
drivers/bluetooth/btbcm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 3006e2a0f37e..a85f3c62b08a 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -504,8 +504,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 */
len = strlen(tmp) + 1;
--
2.17.1
Powered by blists - more mailing lists