[PATCH 09/20] ASoC: codecs: wcd939x: Fix device node leak in wcd939x_populate_dt_data()

From: Wentao Liang

Date: Wed Sep 16 2026 - 03:26:30 EST


In wcd939x_populate_dt_data(), np is obtained via
of_graph_get_remote_node() to check if the remote endpoint exists,
but the returned reference is never dropped, causing a device node
leak.

Declare np with __free(device_node) so that the reference is
automatically released when exiting the function scope.

Fixes: 10f514bd172a ("ASoC: codecs: Add WCD939x Codec driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
sound/soc/codecs/wcd939x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c
index 01f1a08f48e6..022f7b02237d 100644
--- a/sound/soc/codecs/wcd939x.c
+++ b/sound/soc/codecs/wcd939x.c
@@ -3182,7 +3182,7 @@ static int wcd939x_populate_dt_data(struct wcd939x_priv *wcd939x, struct device
{
struct wcd_mbhc_config *cfg = &wcd939x->mbhc_cfg;
#if IS_ENABLED(CONFIG_TYPEC)
- struct device_node *np;
+ struct device_node *np __free(device_node) = NULL;
#endif /* CONFIG_TYPEC */
int ret;

--
2.34.1