From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
Javier Carrasco <javier.carrasco.cruz@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 1/2] Bluetooth: btbcm: fix missing of_node_put() in btbcm_get_board_name()
Date: Wed, 30 Oct 2024 16:46:21 +0100 [thread overview]
Message-ID: <20241030-bluetooth-btbcm-node-cleanup-v1-1-fdc4b9df9fe3@gmail.com> (raw)
In-Reply-To: <20241030-bluetooth-btbcm-node-cleanup-v1-0-fdc4b9df9fe3@gmail.com>
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 --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);
--
2.43.0
next prev parent reply other threads:[~2024-10-30 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 15:46 [PATCH 0/2] Bluetooth: btbcm: fix missing of_node_put() in btbcm_get_board_name() Javier Carrasco
2024-10-30 15:46 ` Javier Carrasco [this message]
2024-10-30 15:46 ` [PATCH 2/2] Bluetooth: btbcm: automate node cleanup " Javier Carrasco
2024-10-31 11:08 ` Krzysztof Kozlowski
2024-10-31 11:10 ` Javier Carrasco
2024-10-31 11:14 ` Krzysztof Kozlowski
2024-10-31 11:29 ` Javier Carrasco
2024-10-31 11:33 ` Krzysztof Kozlowski
2024-10-31 11:44 ` Krzysztof Kozlowski
2024-10-31 11:30 ` Krzysztof Kozlowski
2024-10-31 11:41 ` Javier Carrasco
2024-10-31 11:46 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241030-bluetooth-btbcm-node-cleanup-v1-1-fdc4b9df9fe3@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox