* [PATCH] media-entity: fix sparse warning in media_entity_pads_init()
@ 2016-03-14 8:21 Hans Verkuil
0 siblings, 0 replies; only message in thread
From: Hans Verkuil @ 2016-03-14 8:21 UTC (permalink / raw)
To: Linux Media Mailing List, Laurent Pinchart
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@cisco.com>
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;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-14 8:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14 8:21 [PATCH] media-entity: fix sparse warning in media_entity_pads_init() Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox