From: Dan Carpenter <dan.carpenter@oracle.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] mx3-camera: locking typo in mx3_videobuf_queue()
Date: Sat, 24 Aug 2013 07:06:50 +0000 [thread overview]
Message-ID: <20130824070650.GA19256@mwanda> (raw)
In-Reply-To: <Pine.LNX.4.64.1308232313220.14796@axis700.grange>
On Fri, Aug 23, 2013 at 11:16:51PM +0200, Guennadi Liakhovetski wrote:
> Hi Dan,
>
> On Fri, 23 Aug 2013, Dan Carpenter wrote:
>
> > There is a return in the middle where we haven't restored the IRQs to
> > their original state.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
> > index 1047e3e..4bae910 100644
> > --- a/drivers/media/platform/soc_camera/mx3_camera.c
> > +++ b/drivers/media/platform/soc_camera/mx3_camera.c
> > @@ -334,7 +334,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
> > if (!mx3_cam->active)
> > mx3_cam->active = buf;
> >
> > - spin_unlock_irq(&mx3_cam->lock);
> > + spin_unlock_irqrestore(&mx3_cam->lock, flags);
> >
> > cookie = txd->tx_submit(txd);
> > dev_dbg(icd->parent, "Submitted cookie %d DMA 0x%08x\n",
>
> Please, wait with this. The above doesn't seem quite right to me. IIRC,
> the purpose of unlock_irq(), i.e. of the unconditionally enabling IRQs was
> to make sure ->tx_submit() is called with interrupts enabled. I'm
> currently on holiday with very scarce internet access. Either please
> double-check this yourself or I'll have another look at it when back home
> next week.
>
No problem. This is static checker stuff. The currect code is
definitely wrong because the return in the middle. When the
function returns we don't know if IRQs are enabled or not.
> > @@ -343,7 +343,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
> > if (cookie >= 0)
> > return;
^^^^^^^^^^^
> >
> > - spin_lock_irq(&mx3_cam->lock);
> > + spin_lock_irqsave(&mx3_cam->lock, flags);
I thought about using local_irq_restore(flags) but it seemed like
an obvious oversight.
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] mx3-camera: locking typo in mx3_videobuf_queue()
Date: Sat, 24 Aug 2013 10:06:50 +0300 [thread overview]
Message-ID: <20130824070650.GA19256@mwanda> (raw)
In-Reply-To: <Pine.LNX.4.64.1308232313220.14796@axis700.grange>
On Fri, Aug 23, 2013 at 11:16:51PM +0200, Guennadi Liakhovetski wrote:
> Hi Dan,
>
> On Fri, 23 Aug 2013, Dan Carpenter wrote:
>
> > There is a return in the middle where we haven't restored the IRQs to
> > their original state.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
> > index 1047e3e..4bae910 100644
> > --- a/drivers/media/platform/soc_camera/mx3_camera.c
> > +++ b/drivers/media/platform/soc_camera/mx3_camera.c
> > @@ -334,7 +334,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
> > if (!mx3_cam->active)
> > mx3_cam->active = buf;
> >
> > - spin_unlock_irq(&mx3_cam->lock);
> > + spin_unlock_irqrestore(&mx3_cam->lock, flags);
> >
> > cookie = txd->tx_submit(txd);
> > dev_dbg(icd->parent, "Submitted cookie %d DMA 0x%08x\n",
>
> Please, wait with this. The above doesn't seem quite right to me. IIRC,
> the purpose of unlock_irq(), i.e. of the unconditionally enabling IRQs was
> to make sure ->tx_submit() is called with interrupts enabled. I'm
> currently on holiday with very scarce internet access. Either please
> double-check this yourself or I'll have another look at it when back home
> next week.
>
No problem. This is static checker stuff. The currect code is
definitely wrong because the return in the middle. When the
function returns we don't know if IRQs are enabled or not.
> > @@ -343,7 +343,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb)
> > if (cookie >= 0)
> > return;
^^^^^^^^^^^
> >
> > - spin_lock_irq(&mx3_cam->lock);
> > + spin_lock_irqsave(&mx3_cam->lock, flags);
I thought about using local_irq_restore(flags) but it seemed like
an obvious oversight.
regards,
dan carpenter
next prev parent reply other threads:[~2013-08-24 7:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 9:45 [patch] [media] mx3-camera: locking typo in mx3_videobuf_queue() Dan Carpenter
2013-08-23 9:45 ` Dan Carpenter
2013-08-23 21:16 ` Guennadi Liakhovetski
2013-08-23 21:16 ` Guennadi Liakhovetski
2013-08-24 7:06 ` Dan Carpenter [this message]
2013-08-24 7:06 ` Dan Carpenter
2013-08-28 7:50 ` Guennadi Liakhovetski
2013-08-28 7:50 ` Guennadi Liakhovetski
2013-08-29 8:23 ` [patch v2] [media] mx3-camera: locking cleanup " Dan Carpenter
2013-08-29 8:23 ` Dan Carpenter
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=20130824070650.GA19256@mwanda \
--to=dan.carpenter@oracle.com \
--cc=g.liakhovetski@gmx.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
/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.