Put the endpoint DT node earlier to avoid the need for goto statements
to a cleanup code block in case of errors.

Signed-off-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
---
 drivers/media/platform/soc_camera/atmel-isi.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 90701726a06a..9c900d9569e0 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -891,9 +891,10 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi,
        }
 
        err = v4l2_of_parse_endpoint(np, &ep);
+       of_node_put(np);
        if (err) {
                dev_err(&pdev->dev, "Could not parse the endpoint\n");
-               goto err_probe_dt;
+               return err;
        }
 
        switch (ep.bus.parallel.bus_width) {
@@ -907,14 +908,10 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi,
        default:
                dev_err(&pdev->dev, "Unsupported bus width: %d\n",
                                ep.bus.parallel.bus_width);
-               err = -EINVAL;
-               goto err_probe_dt;
+               return -EINVAL;
        }
 
-err_probe_dt:
-       of_node_put(np);
-
-       return err;
+       return 0;
 }
 
 static int atmel_isi_probe(struct platform_device *pdev)
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to