public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] dwc3: add a kfree() on error to dwc3_testmode_open()
@ 2011-08-26  9:21 Dan Carpenter
       [not found] ` <20110826092113.GO5975-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-08-26  9:21 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg Kroah-Hartman, open list:DESIGNWARE USB3 D...,
	open list:DESIGNWARE USB3 D...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

We may as well fix this potential leak so we don't have to listen to
the static checkers complain.

Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
Btw.  This function returns -EBUSY on success.  Was that really what
you want?

diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index 432df53..dd861c4 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -445,8 +445,10 @@ static int dwc3_testmode_open(struct inode *inode, struct file *file)
 	if (!buf0)
 		return -ENOMEM;
 	buf1 = kmalloc(BUF_SIZE, GFP_KERNEL);
-	if (!buf1)
+	if (!buf1) {
+		kfree(buf0);
 		return -ENOMEM;
+	}
 
 	memset(buf0, 0xaa, BUF_SIZE);
 	memset(buf1, 0x33, BUF_SIZE);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] dwc3: add a kfree() on error to dwc3_testmode_open()
       [not found] ` <20110826092113.GO5975-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
@ 2011-08-26  9:43   ` Felipe Balbi
  2011-08-26 10:32   ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2011-08-26  9:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Felipe Balbi, Greg Kroah-Hartman, open list:DESIGNWARE USB3 D...,
	open list:DESIGNWARE USB3 D...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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

Hi,

On Fri, Aug 26, 2011 at 12:21:13PM +0300, Dan Carpenter wrote:
> We may as well fix this potential leak so we don't have to listen to
> the static checkers complain.
> 
> Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

applied, thanks

-- 
balbi

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

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

* Re: [patch] dwc3: add a kfree() on error to dwc3_testmode_open()
       [not found] ` <20110826092113.GO5975-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
  2011-08-26  9:43   ` Felipe Balbi
@ 2011-08-26 10:32   ` Sebastian Andrzej Siewior
  2011-08-26 10:48     ` Felipe Balbi
  1 sibling, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2011-08-26 10:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Felipe Balbi, Greg Kroah-Hartman, open list:DESIGNWARE USB3 D...,
	open list:DESIGNWARE USB3 D...,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

* Dan Carpenter | 2011-08-26 12:21:13 [+0300]:

>Btw.  This function returns -EBUSY on success.  Was that really what
>you want?

At that time yes. The idea was to enable the self-test mode of the core
and let it do transfers forth and back and see if it works. There is
also no off switch. I wasn't aware that this piece of code is going to
merged but now I think we need an off switch.
Thanks for spotting this.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] dwc3: add a kfree() on error to dwc3_testmode_open()
  2011-08-26 10:32   ` Sebastian Andrzej Siewior
@ 2011-08-26 10:48     ` Felipe Balbi
  0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2011-08-26 10:48 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Dan Carpenter, Felipe Balbi, Greg Kroah-Hartman,
	open list:DESIGNWARE USB3 D..., open list:DESIGNWARE USB3 D...,
	kernel-janitors

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

Hi,

On Fri, Aug 26, 2011 at 12:32:40PM +0200, Sebastian Andrzej Siewior wrote:
> * Dan Carpenter | 2011-08-26 12:21:13 [+0300]:
> 
> >Btw.  This function returns -EBUSY on success.  Was that really what
> >you want?
> 
> At that time yes. The idea was to enable the self-test mode of the core
> and let it do transfers forth and back and see if it works. There is
> also no off switch. I wasn't aware that this piece of code is going to
> merged but now I think we need an off switch.

yeah, this is rather useful to test the underlying HW. We had the same
feature on MUSB and it helped check if EP0 handling and FIFO access was
working fine.

> Thanks for spotting this.

indeed.

-- 
balbi

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

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

end of thread, other threads:[~2011-08-26 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26  9:21 [patch] dwc3: add a kfree() on error to dwc3_testmode_open() Dan Carpenter
     [not found] ` <20110826092113.GO5975-z0WHZYlhLlzP0Z7Jsv878P8+0UxHXcjY@public.gmane.org>
2011-08-26  9:43   ` Felipe Balbi
2011-08-26 10:32   ` Sebastian Andrzej Siewior
2011-08-26 10:48     ` Felipe Balbi

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