public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock
@ 2014-03-10  8:33 Robert Baldyga
  2014-03-10 13:05 ` Michal Nazarewicz
  2014-03-17 23:04 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Baldyga @ 2014-03-10  8:33 UTC (permalink / raw)
  To: balbi
  Cc: gregkh, linux-usb, linux-kernel, mina86, m.szyprowski, andrzej.p,
	Robert Baldyga

This patch adds missing spin_unlock and mutex_unlock calls in
error handling code.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
 drivers/usb/gadget/f_fs.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index b7d273a..d6bd0a3 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -802,7 +802,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
 		if (io_data->aio) {
 			req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
 			if (unlikely(!req))
-				goto error;
+				goto error_lock;
 
 			req->buf      = data;
 			req->length   = io_data->len;
@@ -817,7 +817,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
 			ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
 			if (unlikely(ret)) {
 				usb_ep_free_request(ep->ep, req);
-				goto error;
+				goto error_lock;
 			}
 			ret = -EIOCBQUEUED;
 
@@ -863,6 +863,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
 
 	mutex_unlock(&epfile->mutex);
 	return ret;
+
+error_lock:
+	spin_unlock_irq(&epfile->ffs->eps_lock);
+	mutex_unlock(&epfile->mutex);
 error:
 	kfree(data);
 	return ret;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock
  2014-03-10  8:33 [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock Robert Baldyga
@ 2014-03-10 13:05 ` Michal Nazarewicz
  2014-03-10 19:58   ` Felipe Balbi
  2014-03-17 23:04 ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Michal Nazarewicz @ 2014-03-10 13:05 UTC (permalink / raw)
  To: Robert Baldyga, balbi
  Cc: gregkh, linux-usb, linux-kernel, m.szyprowski, andrzej.p,
	Robert Baldyga

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

On Mon, Mar 10 2014, Robert Baldyga <r.baldyga@samsung.com> wrote:
> This patch adds missing spin_unlock and mutex_unlock calls in
> error handling code.
>
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  drivers/usb/gadget/f_fs.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index b7d273a..d6bd0a3 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -802,7 +802,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
>  		if (io_data->aio) {
>  			req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
>  			if (unlikely(!req))
> -				goto error;
> +				goto error_lock;
>  
>  			req->buf      = data;
>  			req->length   = io_data->len;
> @@ -817,7 +817,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
>  			ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
>  			if (unlikely(ret)) {
>  				usb_ep_free_request(ep->ep, req);
> -				goto error;
> +				goto error_lock;
>  			}
>  			ret = -EIOCBQUEUED;
>  
> @@ -863,6 +863,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
>  
>  	mutex_unlock(&epfile->mutex);
>  	return ret;
> +
> +error_lock:
> +	spin_unlock_irq(&epfile->ffs->eps_lock);
> +	mutex_unlock(&epfile->mutex);
>  error:
>  	kfree(data);
>  	return ret;
> -- 
> 1.7.9.5
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock
  2014-03-10 13:05 ` Michal Nazarewicz
@ 2014-03-10 19:58   ` Felipe Balbi
  0 siblings, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2014-03-10 19:58 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Robert Baldyga, balbi, gregkh, linux-usb, linux-kernel,
	m.szyprowski, andrzej.p

[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]

On Mon, Mar 10, 2014 at 02:05:47PM +0100, Michal Nazarewicz wrote:
> On Mon, Mar 10 2014, Robert Baldyga <r.baldyga@samsung.com> wrote:
> > This patch adds missing spin_unlock and mutex_unlock calls in
> > error handling code.
> >
> > Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> 
> Acked-by: Michal Nazarewicz <mina86@mina86.com>

Greg, here's another one you can pick. It's also a coccicheck fix.

Acked-by: Felipe Balbi <balbi@ti.com>

> > ---
> >  drivers/usb/gadget/f_fs.c |    8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> > index b7d273a..d6bd0a3 100644
> > --- a/drivers/usb/gadget/f_fs.c
> > +++ b/drivers/usb/gadget/f_fs.c
> > @@ -802,7 +802,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> >  		if (io_data->aio) {
> >  			req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
> >  			if (unlikely(!req))
> > -				goto error;
> > +				goto error_lock;
> >  
> >  			req->buf      = data;
> >  			req->length   = io_data->len;
> > @@ -817,7 +817,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> >  			ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
> >  			if (unlikely(ret)) {
> >  				usb_ep_free_request(ep->ep, req);
> > -				goto error;
> > +				goto error_lock;
> >  			}
> >  			ret = -EIOCBQUEUED;
> >  
> > @@ -863,6 +863,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> >  
> >  	mutex_unlock(&epfile->mutex);
> >  	return ret;
> > +
> > +error_lock:
> > +	spin_unlock_irq(&epfile->ffs->eps_lock);
> > +	mutex_unlock(&epfile->mutex);
> >  error:
> >  	kfree(data);
> >  	return ret;
> > -- 
> > 1.7.9.5
> >
> 
> -- 
> Best regards,                                         _     _
> .o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
> ..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
> ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--





-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock
  2014-03-10  8:33 [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock Robert Baldyga
  2014-03-10 13:05 ` Michal Nazarewicz
@ 2014-03-17 23:04 ` Greg KH
  2014-03-17 23:04   ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-03-17 23:04 UTC (permalink / raw)
  To: Robert Baldyga
  Cc: balbi, linux-usb, linux-kernel, mina86, m.szyprowski, andrzej.p

On Mon, Mar 10, 2014 at 09:33:37AM +0100, Robert Baldyga wrote:
> This patch adds missing spin_unlock and mutex_unlock calls in
> error handling code.
> 
> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> Acked-by: Michal Nazarewicz <mina86@mina86.com>
> Acked-by: Felipe Balbi <balbi@ti.com>
> ---
>  drivers/usb/gadget/f_fs.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> index b7d273a..d6bd0a3 100644
> --- a/drivers/usb/gadget/f_fs.c
> +++ b/drivers/usb/gadget/f_fs.c
> @@ -802,7 +802,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
>  		if (io_data->aio) {
>  			req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
>  			if (unlikely(!req))
> -				goto error;
> +				goto error_lock;
>  
>  			req->buf      = data;
>  			req->length   = io_data->len;
> @@ -817,7 +817,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
>  			ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
>  			if (unlikely(ret)) {
>  				usb_ep_free_request(ep->ep, req);
> -				goto error;
> +				goto error_lock;
>  			}
>  			ret = -EIOCBQUEUED;
>  
> @@ -863,6 +863,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
>  
>  	mutex_unlock(&epfile->mutex);
>  	return ret;
> +
> +error_lock:
> +	spin_unlock_irq(&epfile->ffs->eps_lock);
> +	mutex_unlock(&epfile->mutex);
>  error:
>  	kfree(data);
>  	return ret;
> -- 
> 1.7.9.5

This patch doesn't apply to my tree at all :(

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock
  2014-03-17 23:04 ` Greg KH
@ 2014-03-17 23:04   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2014-03-17 23:04 UTC (permalink / raw)
  To: Robert Baldyga
  Cc: balbi, linux-usb, linux-kernel, mina86, m.szyprowski, andrzej.p

On Mon, Mar 17, 2014 at 04:04:04PM -0700, Greg KH wrote:
> On Mon, Mar 10, 2014 at 09:33:37AM +0100, Robert Baldyga wrote:
> > This patch adds missing spin_unlock and mutex_unlock calls in
> > error handling code.
> > 
> > Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
> > Acked-by: Michal Nazarewicz <mina86@mina86.com>
> > Acked-by: Felipe Balbi <balbi@ti.com>
> > ---
> >  drivers/usb/gadget/f_fs.c |    8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
> > index b7d273a..d6bd0a3 100644
> > --- a/drivers/usb/gadget/f_fs.c
> > +++ b/drivers/usb/gadget/f_fs.c
> > @@ -802,7 +802,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> >  		if (io_data->aio) {
> >  			req = usb_ep_alloc_request(ep->ep, GFP_KERNEL);
> >  			if (unlikely(!req))
> > -				goto error;
> > +				goto error_lock;
> >  
> >  			req->buf      = data;
> >  			req->length   = io_data->len;
> > @@ -817,7 +817,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> >  			ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC);
> >  			if (unlikely(ret)) {
> >  				usb_ep_free_request(ep->ep, req);
> > -				goto error;
> > +				goto error_lock;
> >  			}
> >  			ret = -EIOCBQUEUED;
> >  
> > @@ -863,6 +863,10 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> >  
> >  	mutex_unlock(&epfile->mutex);
> >  	return ret;
> > +
> > +error_lock:
> > +	spin_unlock_irq(&epfile->ffs->eps_lock);
> > +	mutex_unlock(&epfile->mutex);
> >  error:
> >  	kfree(data);
> >  	return ret;
> > -- 
> > 1.7.9.5
> 
> This patch doesn't apply to my tree at all :(

Ick, wrong tree, nevermind...

greg "too many kernel trees" k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-17 23:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10  8:33 [PATCH] usb: gadget: f_fs: add missing spinlock and mutex unlock Robert Baldyga
2014-03-10 13:05 ` Michal Nazarewicz
2014-03-10 19:58   ` Felipe Balbi
2014-03-17 23:04 ` Greg KH
2014-03-17 23:04   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox