Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f11552d0 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Mauro Carvalho Chehab
Browse files

media: stm32-dcmi: simplify of_node_put usage



This does not fix any bug - this is just a code simplification. As
np is not used after passing it to v4l2_fwnode_endpoint_parse() its
refcount can be decremented immediately and at one location.

Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent c2ee2243
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -1655,23 +1655,20 @@ static int dcmi_probe(struct platform_device *pdev)
	}
	}


	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
	ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep);
	of_node_put(np);
	if (ret) {
	if (ret) {
		dev_err(&pdev->dev, "Could not parse the endpoint\n");
		dev_err(&pdev->dev, "Could not parse the endpoint\n");
		of_node_put(np);
		return -ENODEV;
		return -ENODEV;
	}
	}


	if (ep.bus_type == V4L2_MBUS_CSI2) {
	if (ep.bus_type == V4L2_MBUS_CSI2) {
		dev_err(&pdev->dev, "CSI bus not supported\n");
		dev_err(&pdev->dev, "CSI bus not supported\n");
		of_node_put(np);
		return -ENODEV;
		return -ENODEV;
	}
	}
	dcmi->bus.flags = ep.bus.parallel.flags;
	dcmi->bus.flags = ep.bus.parallel.flags;
	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
	dcmi->bus.data_shift = ep.bus.parallel.data_shift;


	of_node_put(np);

	irq = platform_get_irq(pdev, 0);
	irq = platform_get_irq(pdev, 0);
	if (irq <= 0) {
	if (irq <= 0) {
		dev_err(&pdev->dev, "Could not get irq\n");
		dev_err(&pdev->dev, "Could not get irq\n");