Skip to content

Commit

Permalink
leds: 88pm860x: Fix missing refcount decrement for parent of_node
Browse files Browse the repository at this point in the history
The driver obtained the reference to parent->of_node but immediately it
was overwritten by reference to child node 'leds'. The of_node_put at
the end of DT parsing function decremented only the child 'leds' so
effectively the reference to parent of_node leaked.

Getting reference to parent->of_node is not needed at all so get rid of
it to fix the reference count.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
Krzysztof Kozlowski authored and Bryan Wu committed May 8, 2014
1 parent 77dfa77 commit 1175d5b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/leds/leds-88pm860x.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ static int pm860x_led_dt_init(struct platform_device *pdev,
struct device_node *nproot, *np;
int iset = 0;

nproot = of_node_get(pdev->dev.parent->of_node);
if (!nproot)
if (!pdev->dev.parent->of_node)
return -ENODEV;
nproot = of_get_child_by_name(nproot, "leds");
nproot = of_get_child_by_name(pdev->dev.parent->of_node, "leds");
if (!nproot) {
dev_err(&pdev->dev, "failed to find leds node\n");
return -ENODEV;
Expand Down

0 comments on commit 1175d5b

Please sign in to comment.