Use of_get_child_by_name to obtain reference to charger node instead of
of_find_node_by_name which can walk outside of the parent node.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/rtc/rtc-88pm860x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
index 816504846cdd..fb9e3c63b4ac 100644
--- a/drivers/rtc/rtc-88pm860x.c
+++ b/drivers/rtc/rtc-88pm860x.c
@@ -293,7 +293,7 @@ static int pm860x_rtc_dt_init(struct platform_device *pdev,
int ret;
if (!np)
return -ENODEV;
- np = of_find_node_by_name(np, "rtc");
+ np = of_get_child_by_name(np, "rtc");
if (!np) {
dev_err(&pdev->dev, "failed to find rtc node\n");
return -ENODEV;
--
1.9.1
Add missing of_node_put to decrement the reference count.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/rtc/rtc-88pm860x.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
index fb9e3c63b4ac..0c6add1a38dc 100644
--- a/drivers/rtc/rtc-88pm860x.c
+++ b/drivers/rtc/rtc-88pm860x.c
@@ -301,6 +301,7 @@ static int pm860x_rtc_dt_init(struct platform_device *pdev,
ret = of_property_read_u32(np, "marvell,88pm860x-vrtc", &info->vrtc);
if (ret)
info->vrtc = 0;
+ of_node_put(np);
return 0;
}
#else
--
1.9.1
On Wednesday, April 23, 2014 9:29 PM, Krzysztof Kozlowski wrote:
>
> Use of_get_child_by_name to obtain reference to charger node instead of
> of_find_node_by_name which can walk outside of the parent node.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Jingoo Han <[email protected]>
Best regards,
Jingoo Han
> ---
> drivers/rtc/rtc-88pm860x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
> index 816504846cdd..fb9e3c63b4ac 100644
> --- a/drivers/rtc/rtc-88pm860x.c
> +++ b/drivers/rtc/rtc-88pm860x.c
> @@ -293,7 +293,7 @@ static int pm860x_rtc_dt_init(struct platform_device *pdev,
> int ret;
> if (!np)
> return -ENODEV;
> - np = of_find_node_by_name(np, "rtc");
> + np = of_get_child_by_name(np, "rtc");
> if (!np) {
> dev_err(&pdev->dev, "failed to find rtc node\n");
> return -ENODEV;
> --
> 1.9.1
On Wednesday, April 23, 2014 9:29 PM, Krzysztof Kozlowski wrote:
>
> Add missing of_node_put to decrement the reference count.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Jingoo Han <[email protected]>
Best regards,
Jingoo Han
> ---
> drivers/rtc/rtc-88pm860x.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
> index fb9e3c63b4ac..0c6add1a38dc 100644
> --- a/drivers/rtc/rtc-88pm860x.c
> +++ b/drivers/rtc/rtc-88pm860x.c
> @@ -301,6 +301,7 @@ static int pm860x_rtc_dt_init(struct platform_device *pdev,
> ret = of_property_read_u32(np, "marvell,88pm860x-vrtc", &info->vrtc);
> if (ret)
> info->vrtc = 0;
> + of_node_put(np);
> return 0;
> }
> #else
> --
> 1.9.1
On Wed, 23 Apr 2014 14:29:27 +0200 Krzysztof Kozlowski <[email protected]> wrote:
> Use of_get_child_by_name to obtain reference to charger node instead of
> of_find_node_by_name which can walk outside of the parent node.
When fixing bugs please always include a description of the end-user
visible effects of that bug so that others can work out which kernel
versions need the fix.
Thanks.