[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK5ve-J9hwdHqRumjYxNnaOmgQ=F9yrf1N+VgpAMagTBy-Pytg@mail.gmail.com>
Date: Fri, 18 Apr 2014 18:33:09 -0700
From: Bryan Wu <cooloney@...il.com>
To: Krzysztof Kozlowski <k.kozlowski@...sung.com>
Cc: Richard Purdie <rpurdie@...ys.net>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] leds: 88pm860x: Fix missing refcount decrement for
parent of_node
On Fri, Apr 4, 2014 at 12:51 AM, Krzysztof Kozlowski
<k.kozlowski@...sung.com> wrote:
> 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.
>
Good catch, thanks. I merged it into my for-next branch as well.
-Bryan
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@...sung.com>
> ---
> drivers/leds/leds-88pm860x.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
> index 2f9ee538f30d..fb7c310e9f20 100644
> --- a/drivers/leds/leds-88pm860x.c
> +++ b/drivers/leds/leds-88pm860x.c
> @@ -131,10 +131,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;
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists