* [PATCH] fbdev: omapfb: Call of_node_put(ep) only once in omapdss_of_find_source_for_first_ep()
@ 2024-09-25 19:21 Markus Elfring
2024-09-25 19:35 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-09-25 19:21 UTC (permalink / raw)
To: linux-omap, linux-fbdev, dri-devel, Helge Deller,
Kuninori Morimoto, Laurent Pinchart, Dave Airlie, Rob Clark,
Tomi Valkeinen
Cc: LKML, kernel-janitors, Krzysztof Kozlowski
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 25 Sep 2024 21:12:36 +0200
An of_node_put(ep) call was immediately used after a pointer check
for a of_graph_get_remote_port() call in this function implementation.
Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
index 4040e247e026..d5a43b3bf45e 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
@@ -129,12 +129,9 @@ omapdss_of_find_source_for_first_ep(struct device_node *node)
return ERR_PTR(-EINVAL);
src_port = of_graph_get_remote_port(ep);
- if (!src_port) {
- of_node_put(ep);
- return ERR_PTR(-EINVAL);
- }
-
of_node_put(ep);
+ if (!src_port)
+ return ERR_PTR(-EINVAL);
src = omap_dss_find_output_by_port_node(src_port);
--
2.46.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] fbdev: omapfb: Call of_node_put(ep) only once in omapdss_of_find_source_for_first_ep()
2024-09-25 19:21 [PATCH] fbdev: omapfb: Call of_node_put(ep) only once in omapdss_of_find_source_for_first_ep() Markus Elfring
@ 2024-09-25 19:35 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2024-09-25 19:35 UTC (permalink / raw)
To: Markus Elfring, linux-omap, linux-fbdev, dri-devel,
Kuninori Morimoto, Laurent Pinchart, Dave Airlie, Rob Clark,
Tomi Valkeinen
Cc: LKML, kernel-janitors, Krzysztof Kozlowski
On 9/25/24 21:21, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 25 Sep 2024 21:12:36 +0200
>
> An of_node_put(ep) call was immediately used after a pointer check
> for a of_graph_get_remote_port() call in this function implementation.
> Thus call such a function only once instead directly before the check.
>
> This issue was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
applied.
Thanks!
Helge
> ---
> drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
> index 4040e247e026..d5a43b3bf45e 100644
> --- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
> +++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
> @@ -129,12 +129,9 @@ omapdss_of_find_source_for_first_ep(struct device_node *node)
> return ERR_PTR(-EINVAL);
>
> src_port = of_graph_get_remote_port(ep);
> - if (!src_port) {
> - of_node_put(ep);
> - return ERR_PTR(-EINVAL);
> - }
> -
> of_node_put(ep);
> + if (!src_port)
> + return ERR_PTR(-EINVAL);
>
> src = omap_dss_find_output_by_port_node(src_port);
>
> --
> 2.46.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-25 19:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25 19:21 [PATCH] fbdev: omapfb: Call of_node_put(ep) only once in omapdss_of_find_source_for_first_ep() Markus Elfring
2024-09-25 19:35 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox