Commit 37512397 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: atmel-isi: Simplify error handling during DT parsing

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: default avatarJosh Wu <josh.wu@atmel.com>
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 9626d03e
...@@ -899,9 +899,10 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi, ...@@ -899,9 +899,10 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi,
} }
err = v4l2_of_parse_endpoint(np, &ep); err = v4l2_of_parse_endpoint(np, &ep);
of_node_put(np);
if (err) { if (err) {
dev_err(&pdev->dev, "Could not parse the endpoint\n"); dev_err(&pdev->dev, "Could not parse the endpoint\n");
goto err_probe_dt; return err;
} }
switch (ep.bus.parallel.bus_width) { switch (ep.bus.parallel.bus_width) {
...@@ -915,14 +916,10 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi, ...@@ -915,14 +916,10 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi,
default: default:
dev_err(&pdev->dev, "Unsupported bus width: %d\n", dev_err(&pdev->dev, "Unsupported bus width: %d\n",
ep.bus.parallel.bus_width); ep.bus.parallel.bus_width);
err = -EINVAL; return -EINVAL;
goto err_probe_dt;
} }
err_probe_dt: return 0;
of_node_put(np);
return err;
} }
static int atmel_isi_probe(struct platform_device *pdev) static int atmel_isi_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment