Skip to content

Commit 4ee9486

Browse files
Lucas Tanurerfvirgil
authored andcommitted
Asoc: tacna: Increment refcount of a node when sharing of_node
When copying the pointer of the of_node rather than grabbing a reference counted handle to it, the receiver module can remove the node if refcount gets zero (during his unload steps), even if the owner of the node it's still loaded. Because the owner didn't incresead the refcount before sharing. For example, the mfd children will execute, as part of their unloading process: platform_device_release() -> of_device_node_put() -> of_node_put() Which will be asymmetric with of_node_get()s, because just copying the pointer don't increse the refcount, but using of_node_get will increase. Change-Id: Icf2c4e608ab3037f4e91234135cda5b793fb25aa Signed-off-by: Lucas Tanure <[email protected]>
1 parent 3575e59 commit 4ee9486

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sound/soc/codecs/cs47l96.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ static int cs47l96_probe(struct platform_device *pdev)
28102810
return -ENOMEM;
28112811

28122812
platform_set_drvdata(pdev, cs47l96);
2813-
pdev->dev.of_node = tacna->dev->of_node;
2813+
pdev->dev.of_node = of_node_get(tacna->dev->of_node);
28142814

28152815
cs47l96->core.tacna = tacna;
28162816
cs47l96->core.dev = &pdev->dev;

sound/soc/codecs/cs48l32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ static int cs48l32_probe(struct platform_device *pdev)
13801380
return -ENOMEM;
13811381

13821382
platform_set_drvdata(pdev, cs48l32);
1383-
pdev->dev.of_node = tacna->dev->of_node;
1383+
pdev->dev.of_node = of_node_get(tacna->dev->of_node);
13841384

13851385
cs48l32->core.tacna = tacna;
13861386
cs48l32->core.dev = &pdev->dev;

0 commit comments

Comments
 (0)