Removing a link is simple. Yet, better to have a separate function for it, as we'll be also sharing it with a public API call. Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index c68dc421b022..8e77f2ae7197 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -489,6 +489,12 @@ static struct media_link *__media_create_link(struct media_device *mdev, return link; } +static void __media_remove_link(struct media_link *link) +{ + list_del(&link->list); + kfree(link); +} + static void __media_entity_remove_link(struct media_entity *entity, struct media_link *link) { @@ -514,11 +520,9 @@ static void __media_entity_remove_link(struct media_entity *entity, break; /* Remove the remote link */ - list_del(&rlink->list); - kfree(rlink); + __media_remove_link(rlink); } - list_del(&link->list); - kfree(link); + __media_remove_link(link); } int -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html