media: atmel-isi: move of_node_put() to cover success branch as well
authorNicholas Mc Guire <hofrat@osadl.org>
Fri, 1 Jun 2018 13:30:14 +0000 (09:30 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 28 Jun 2018 10:50:28 +0000 (06:50 -0400)
The of_node_put() was only covering the error branch but missed the
success branch so the refcount for ep which
of_graph_get_remote_port_parent() incremented on success would was
not being decremented.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/atmel/atmel-isi.c

index 85fc7b9..e8db4df 100644 (file)
@@ -1111,10 +1111,9 @@ static int isi_graph_parse(struct atmel_isi *isi, struct device_node *node)
                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 */
        isi->entity.node = remote;