From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linux Media Mailing List <linux-media@vger.kernel.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [PATCH] media-entity: fix sparse warning in media_entity_pads_init()
Date: Mon, 14 Mar 2016 09:21:46 +0100 [thread overview]
Message-ID: <56E6749A.405@xs4all.nl> (raw)
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;
}
reply other threads:[~2016-03-14 8:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E6749A.405@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox