mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
video: fbdev: amba-clcd: Fix refcount leak bugs
[ Upstream commit26c2b7d9fa
] In clcdfb_of_init_display(), we should call of_node_put() for the references returned by of_graph_get_next_endpoint() and of_graph_get_remote_port_parent() which have increased the refcount. Besides, we should call of_node_put() both in fail path or when the references are not used anymore. Fixes:d10715be03
("video: ARM CLCD: Add DT support") Signed-off-by: Liang He <windhl@126.com> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
db7bc17d33
commit
2688df86c0
1 changed files with 18 additions and 6 deletions
|
@ -772,8 +772,10 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
panel = of_graph_get_remote_port_parent(endpoint);
|
panel = of_graph_get_remote_port_parent(endpoint);
|
||||||
if (!panel)
|
if (!panel) {
|
||||||
return -ENODEV;
|
err = -ENODEV;
|
||||||
|
goto out_endpoint_put;
|
||||||
|
}
|
||||||
|
|
||||||
if (fb->vendor->init_panel) {
|
if (fb->vendor->init_panel) {
|
||||||
err = fb->vendor->init_panel(fb, panel);
|
err = fb->vendor->init_panel(fb, panel);
|
||||||
|
@ -783,11 +785,11 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)
|
||||||
|
|
||||||
err = clcdfb_of_get_backlight(panel, fb->panel);
|
err = clcdfb_of_get_backlight(panel, fb->panel);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto out_panel_put;
|
||||||
|
|
||||||
err = clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel);
|
err = clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto out_panel_put;
|
||||||
|
|
||||||
err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth",
|
err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth",
|
||||||
&max_bandwidth);
|
&max_bandwidth);
|
||||||
|
@ -816,11 +818,21 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)
|
||||||
|
|
||||||
if (of_property_read_u32_array(endpoint,
|
if (of_property_read_u32_array(endpoint,
|
||||||
"arm,pl11x,tft-r0g0b0-pads",
|
"arm,pl11x,tft-r0g0b0-pads",
|
||||||
tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) != 0)
|
tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) != 0) {
|
||||||
return -ENOENT;
|
err = -ENOENT;
|
||||||
|
goto out_panel_put;
|
||||||
|
}
|
||||||
|
|
||||||
|
of_node_put(panel);
|
||||||
|
of_node_put(endpoint);
|
||||||
|
|
||||||
return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0],
|
return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0],
|
||||||
tft_r0b0g0[1], tft_r0b0g0[2]);
|
tft_r0b0g0[1], tft_r0b0g0[2]);
|
||||||
|
out_panel_put:
|
||||||
|
of_node_put(panel);
|
||||||
|
out_endpoint_put:
|
||||||
|
of_node_put(endpoint);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clcdfb_of_vram_setup(struct clcd_fb *fb)
|
static int clcdfb_of_vram_setup(struct clcd_fb *fb)
|
||||||
|
|
Loading…
Reference in a new issue