@@ -142,19 +142,16 @@ int tilcdc_get_external_components(struct device *dev,
int count = 0;
while ((ep = of_graph_get_next_endpoint(dev->of_node, ep))) {
- struct device_node *node;
-
- node = of_graph_get_remote_port_parent(ep);
- if (!node && !of_device_is_available(node)) {
- of_node_put(node);
- continue;
+ struct device_node *node = of_graph_get_remote_port_parent(ep);
+
+ if (node && of_device_is_available(node)) {
+ dev_dbg(dev, "Subdevice node '%s' found\n", node->name);
+ if (match)
+ component_match_add(dev, match, dev_match_of,
+ node);
+ count++;
}
-
- dev_dbg(dev, "Subdevice node '%s' found\n", node->name);
- if (match)
- component_match_add(dev, match, dev_match_of, node);
of_node_put(node);
- count++;
}
if (count > 1) {
The if statement condition should have been "!node || !of_device_is_available(node)" (&& changed to ||), but let's rewrite the whole inside of the loop for better readability. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> --- drivers/gpu/drm/tilcdc/tilcdc_external.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)