All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Lee Jones <lee.jones@linaro.org>, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH] [media] timblogiw: protect desc
Date: Wed, 23 Dec 2015 15:51:26 -0200	[thread overview]
Message-ID: <acc4439ff9d57b4e233d70415e70e37a85c695a5.1450893079.git.mchehab@osg.samsung.com> (raw)

As sparse complains:
	drivers/media/platform/timblogiw.c:562:22: warning: context imbalance in 'buffer_queue' - unexpected unlock

there's something weird at the logic there. The semaphore seems
to be protecting changes at the desc struct, however, the
callback logic is not protected.

Compile-tested only.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/platform/timblogiw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/timblogiw.c b/drivers/media/platform/timblogiw.c
index 113c9f3c0b3e..a5d2607cc396 100644
--- a/drivers/media/platform/timblogiw.c
+++ b/drivers/media/platform/timblogiw.c
@@ -566,8 +566,8 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
 	desc = dmaengine_prep_slave_sg(fh->chan,
 		buf->sg, sg_elems, DMA_DEV_TO_MEM,
 		DMA_PREP_INTERRUPT);
+	spin_lock_irq(&fh->queue_lock);
 	if (!desc) {
-		spin_lock_irq(&fh->queue_lock);
 		list_del_init(&vb->queue);
 		vb->state = VIDEOBUF_PREPARED;
 		return;
@@ -576,8 +576,8 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
 	desc->callback_param = buf;
 	desc->callback = timblogiw_dma_cb;
 
+	spin_unlock_irq(&fh->queue_lock);
 	buf->cookie = desc->tx_submit(desc);
-
 	spin_lock_irq(&fh->queue_lock);
 }
 
-- 
2.5.0


                 reply	other threads:[~2015-12-23 17:51 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=acc4439ff9d57b4e233d70415e70e37a85c695a5.1450893079.git.mchehab@osg.samsung.com \
    --to=mchehab@osg.samsung.com \
    --cc=arnd@arndb.de \
    --cc=k.kozlowski@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.