]> www.infradead.org Git - linux.git/commitdiff
fbdev: omapfb: Call of_node_put(ep) only once in omapdss_of_find_source_for_first_ep()
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 25 Sep 2024 19:12:36 +0000 (21:12 +0200)
committerHelge Deller <deller@gmx.de>
Thu, 26 Sep 2024 16:20:27 +0000 (18:20 +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>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c

index 4040e247e026e967673dbc7fa07ba6fac8e4e8af..d5a43b3bf45ec9b09355707561ab2b8115c67ffb 100644 (file)
@@ -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);