Fix this sparse warning: drivers/media/media-entity.c:212:5: warning: context imbalance in 'media_entity_pads_init' - different lock contexts for basic block Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index e95070b..be29d62 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -217,20 +217,19 @@ int media_entity_pads_init(struct media_entity *entity, u16 num_pads, entity->num_pads = num_pads; entity->pads = pads; - - if (mdev) - spin_lock(&mdev->lock); - for (i = 0; i < num_pads; i++) { pads[i].entity = entity; pads[i].index = i; - if (mdev) - media_gobj_create(mdev, MEDIA_GRAPH_PAD, - &entity->pads[i].graph_obj); } - if (mdev) - spin_unlock(&mdev->lock); + if (mdev == NULL) + return 0; + + spin_lock(&mdev->lock); + for (i = 0; i < num_pads; i++) + media_gobj_create(mdev, MEDIA_GRAPH_PAD, + &entity->pads[i].graph_obj); + spin_unlock(&mdev->lock); return 0; } -- 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