]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/drm-rcar-du-add-missing-of_node_put.patch
723781ea3785e0386a518d5edb33fa23f5cf6b6e
[thirdparty/kernel/stable-queue.git] / queue-4.19 / drm-rcar-du-add-missing-of_node_put.patch
1 From bb9550704501513f1b09934e57953a2d042ec9c6 Mon Sep 17 00:00:00 2001
2 From: Julia Lawall <julia.lawall@lip6.fr>
3 Date: Mon, 14 Jan 2019 17:44:56 +0100
4 Subject: drm: rcar-du: add missing of_node_put
5
6 [ Upstream commit 4c6d8fc20b09f9684743afd72e4dbc3f15524479 ]
7
8 Add an of_node_put when the result of of_graph_get_remote_port_parent is
9 not available.
10
11 Add a second of_node_put if no encoder is selected (encoder remains NULL).
12
13 The semantic match that finds the first problem is as follows
14 (http://coccinelle.lip6.fr):
15
16 // <smpl>
17 @r exists@
18 local idexpression e;
19 expression x;
20 @@
21 e = of_graph_get_remote_port_parent(...);
22 ... when != x = e
23 when != true e == NULL
24 when != of_node_put(e)
25 when != of_fwnode_handle(e)
26 (
27 return e;
28 |
29 *return ...;
30 )
31 // </smpl>
32
33 Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
34 Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
35 Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
36 Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
37 Signed-off-by: Sasha Levin <sashal@kernel.org>
38 ---
39 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 ++
40 1 file changed, 2 insertions(+)
41
42 diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
43 index fb46df56f0c4..0386b454e221 100644
44 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
45 +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
46 @@ -300,6 +300,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
47 dev_dbg(rcdu->dev,
48 "connected entity %pOF is disabled, skipping\n",
49 entity);
50 + of_node_put(entity);
51 return -ENODEV;
52 }
53
54 @@ -335,6 +336,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
55 dev_warn(rcdu->dev,
56 "no encoder found for endpoint %pOF, skipping\n",
57 ep->local_node);
58 + of_node_put(entity);
59 return -ENODEV;
60 }
61
62 --
63 2.19.1
64