The endpoint allocated by of_graph_get_next_endpoint() needs an of_node_put()
in both error and success path. As  ep  is not used the refcount decrement
can be right after the last use of  ep.
Fixes: commit 37404f91ef8b ("[media] stm32-dcmi: STM32 DCMI camera interface driver")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
                return -EINVAL;
 
        remote = of_graph_get_remote_port_parent(ep);
-       if (!remote) {
-               of_node_put(ep);
+       of_node_put(ep);
+       if (!remote)
                return -EINVAL;
-       }
 
        /* Remote node to connect */
        dcmi->entity.node = remote;