diff mbox series

soundwire: slave: fix an OF node reference leak in soundwire slave device

Message ID 20241205034844.2784964-1-joe@pf.is.s.u-tokyo.ac.jp (mailing list archive)
State New
Headers show
Series soundwire: slave: fix an OF node reference leak in soundwire slave device | expand

Commit Message

Joe Hattori Dec. 5, 2024, 3:48 a.m. UTC
When initializing a soundwire slave device, an OF node is stored to the
device with refcount incremented. However, the refcount is not
decremented in .release(), thus call of_node_put() in
sdw_slave_release().

Fixes: a2e484585ad3 ("soundwire: core: add device tree support for slave devices")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
---
 drivers/soundwire/slave.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Krzysztof Kozlowski Dec. 17, 2024, 11:28 a.m. UTC | #1
On 05/12/2024 04:48, Joe Hattori wrote:
> When initializing a soundwire slave device, an OF node is stored to the
> device with refcount incremented. However, the refcount is not
> decremented in .release(), thus call of_node_put() in
> sdw_slave_release().
> 
> Fixes: a2e484585ad3 ("soundwire: core: add device tree support for slave devices")
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index 4869b073b11c..d2d99555ec5a 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -13,6 +13,7 @@  static void sdw_slave_release(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 
+	of_node_put(slave->dev.of_node);
 	mutex_destroy(&slave->sdw_dev_lock);
 	kfree(slave);
 }