Skip to contentSkip to conversation

Patch "ASoC: twl4030: fix child-node lookup" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 30, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ASoC: twl4030: fix child-node lookup

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
asoc-twl4030-fix-child-node-lookup.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 15f8c5f2415bfac73f33a14bcd83422bcbfb5298 Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Mon, 13 Nov 2017 12:12:56 +0100
Subject: ASoC: twl4030: fix child-node lookup

From: Johan Hovold <[email protected]>

commit 15f8c5f2415bfac73f33a14bcd83422bcbfb5298 upstream.

Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children.

To make things worse, the parent codec node was also prematurely freed, while the child node was leaked.

Fixes 2d6d649a2e0f ("ASoC: twl4030: Support for DT booted kernel")
---
 sound/soc/codecs/twl4030.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/twl4030.c +3 -1
@@ -232,7 +232,7 @@ static struct twl4030_codec_data *twl403
 	struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev);
 	struct device_node *twl4030_codec_node = NULL;
 
-	twl4030_codec_node = of_find_node_by_name(codec->dev->parent->of_node,
+	twl4030_codec_node = of_get_child_by_name(codec->dev->parent->of_node,
 						  "codec");
 
 	if (!pdata && twl4030_codec_node) {
@@ -241,9 +241,11 @@ static struct twl4030_codec_data *twl403
 				     GFP_KERNEL);
 		if (!pdata) {
 			dev_err(codec->dev, "Can not allocate memory\n");
+			of_node_put(twl4030_codec_node);
 			return NULL;
 		}
 		twl4030_setup_pdata_of(pdata, twl4030_codec_node);
+		of_node_put(twl4030_codec_node);
 	}
 
 	return pdata;

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/asoc-twl4030-fix-child-node-lookup.patch queue-4.14/asoc-da7218-fix-fix-child-node-lookup.patch