]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.18.114/backlight-max8925_bl-fix-device-tree-node-lookup.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.18.114 / backlight-max8925_bl-fix-device-tree-node-lookup.patch
1 From d1cc0ec3da23e44c23712579515494b374f111c9 Mon Sep 17 00:00:00 2001
2 From: Johan Hovold <johan@kernel.org>
3 Date: Mon, 20 Nov 2017 11:45:45 +0100
4 Subject: backlight: max8925_bl: Fix Device Tree node lookup
5
6 From: Johan Hovold <johan@kernel.org>
7
8 commit d1cc0ec3da23e44c23712579515494b374f111c9 upstream.
9
10 Fix child-node lookup during probe, which ended up searching the whole
11 device tree depth-first starting at the parent rather than just matching
12 on its children.
13
14 To make things worse, the parent mfd node was also prematurely freed,
15 while the child backlight node was leaked.
16
17 Cc: stable <stable@vger.kernel.org> # 3.9
18 Fixes: 47ec340cb8e2 ("mfd: max8925: Support dt for backlight")
19 Signed-off-by: Johan Hovold <johan@kernel.org>
20 Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
21 Signed-off-by: Lee Jones <lee.jones@linaro.org>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 drivers/video/backlight/max8925_bl.c | 4 +++-
26 1 file changed, 3 insertions(+), 1 deletion(-)
27
28 --- a/drivers/video/backlight/max8925_bl.c
29 +++ b/drivers/video/backlight/max8925_bl.c
30 @@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(st
31 if (!pdata)
32 return;
33
34 - np = of_find_node_by_name(nproot, "backlight");
35 + np = of_get_child_by_name(nproot, "backlight");
36 if (!np) {
37 dev_err(&pdev->dev, "failed to find backlight node\n");
38 return;
39 @@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(st
40 if (!of_property_read_u32(np, "maxim,max8925-dual-string", &val))
41 pdata->dual_string = val;
42
43 + of_node_put(np);
44 +
45 pdev->dev.platform_data = pdata;
46 }
47