Hi Mauro,
On Mon, Oct 12, 2015 at 01:43:13PM -0300, Mauro Carvalho Chehab wrote: ...
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 0926f08be981..d5efa0e2c88c 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -221,21 +221,13 @@ int media_entity_init(struct media_entity *entity, u16 num_pads, struct media_pad *pads) {
struct media_link *links;
unsigned int max_links = num_pads; unsigned int i;
links = kzalloc(max_links * sizeof(links[0]), GFP_KERNEL);
if (links == NULL)
return -ENOMEM;
entity->group_id = 0;
entity->max_links = max_links; entity->num_links = 0; entity->num_backlinks = 0; entity->num_pads = num_pads; entity->pads = pads;
entity->links = links;
for (i = 0; i < num_pads; i++) { pads[i].entity = entity;
@@ -249,7 +241,13 @@ EXPORT_SYMBOL_GPL(media_entity_init); void media_entity_cleanup(struct media_entity *entity) {
- kfree(entity->links);
- struct media_link *link, *tmp;
- list_for_each_entry_safe(link, tmp, &entity->links, list) {
media_gobj_remove(&link->graph_obj);
list_del(&link->list);
kfree(link);
- }
} EXPORT_SYMBOL_GPL(media_entity_cleanup);
@@ -275,7 +273,7 @@ static void stack_push(struct media_entity_graph *graph, return; } graph->top++;
- graph->stack[graph->top].link = 0;
- graph->stack[graph->top].link = (&entity->links)->next;
... entity->links.next;
graph->stack[graph->top].entity = entity; }
@@ -317,6 +315,7 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, } EXPORT_SYMBOL_GPL(media_entity_graph_walk_start);
Extra newline.
/**
- media_entity_graph_walk_next - Get the next entity in the graph
- @graph: Media graph structure
@@ -340,14 +339,16 @@ media_entity_graph_walk_next(struct media_entity_graph *graph) * top of the stack until no more entities on the level can be * found. */
- while (link_top(graph) < stack_top(graph)->num_links) {
- while (link_top(graph) != &(stack_top(graph)->links)) {
&stack_top(graph)->links should be fine w/o the parentheses.
struct media_entity *entity = stack_top(graph);
struct media_link *link = &entity->links[link_top(graph)];
struct media_link *link;
struct media_entity *next;
link = list_entry(link_top(graph), typeof(*link), list);
/* The link is not enabled so we do not follow. */ if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
link_top(graph)++;
}link_top(graph) = link_top(graph)->next; continue;