of: Reduce indentation in of_graph_get_next_endpoint
A 'return endpoint;' at the end of the (!prev) case allows to reduce the indentation level of the (prev) case. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
This commit is contained in:
		
					parent
					
						
							
								6ff60d397b
							
						
					
				
			
			
				commit
				
					
						4329b93b28
					
				
			
		
					 1 changed files with 25 additions and 23 deletions
				
			
		|  | @ -2026,32 +2026,34 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, | |||
| 			pr_err("%s(): no endpoint nodes specified for %s\n", | ||||
| 			       __func__, parent->full_name); | ||||
| 		of_node_put(node); | ||||
| 	} else { | ||||
| 		port = of_get_parent(prev); | ||||
| 		if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", | ||||
| 			      __func__, prev->full_name)) | ||||
| 			return NULL; | ||||
| 
 | ||||
| 		/* Avoid dropping prev node refcount to 0. */ | ||||
| 		of_node_get(prev); | ||||
| 		endpoint = of_get_next_child(port, prev); | ||||
| 		if (endpoint) { | ||||
| 			of_node_put(port); | ||||
| 			return endpoint; | ||||
| 		} | ||||
| 
 | ||||
| 		/* No more endpoints under this port, try the next one. */ | ||||
| 		do { | ||||
| 			port = of_get_next_child(parent, port); | ||||
| 			if (!port) | ||||
| 				return NULL; | ||||
| 		} while (of_node_cmp(port->name, "port")); | ||||
| 
 | ||||
| 		/* Pick up the first endpoint in this port. */ | ||||
| 		endpoint = of_get_next_child(port, NULL); | ||||
| 		of_node_put(port); | ||||
| 		return endpoint; | ||||
| 	} | ||||
| 
 | ||||
| 	port = of_get_parent(prev); | ||||
| 	if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", | ||||
| 		      __func__, prev->full_name)) | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	/* Avoid dropping prev node refcount to 0. */ | ||||
| 	of_node_get(prev); | ||||
| 	endpoint = of_get_next_child(port, prev); | ||||
| 	if (endpoint) { | ||||
| 		of_node_put(port); | ||||
| 		return endpoint; | ||||
| 	} | ||||
| 
 | ||||
| 	/* No more endpoints under this port, try the next one. */ | ||||
| 	do { | ||||
| 		port = of_get_next_child(parent, port); | ||||
| 		if (!port) | ||||
| 			return NULL; | ||||
| 	} while (of_node_cmp(port->name, "port")); | ||||
| 
 | ||||
| 	/* Pick up the first endpoint in this port. */ | ||||
| 	endpoint = of_get_next_child(port, NULL); | ||||
| 	of_node_put(port); | ||||
| 
 | ||||
| 	return endpoint; | ||||
| } | ||||
| EXPORT_SYMBOL(of_graph_get_next_endpoint); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Philipp Zabel
				Philipp Zabel