linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: udc: atmel: used managed kasprintf
@ 2016-12-01 10:26 Alexandre Belloni
  2016-12-01 11:20 ` Nicolas Ferre
  2016-12-02 15:59 ` David Laight
  0 siblings, 2 replies; 8+ messages in thread
From: Alexandre Belloni @ 2016-12-01 10:26 UTC (permalink / raw)
  To: linux-arm-kernel

Use devm_kasprintf instead of simple kasprintf to free the allocated memory
when needed.

Suggested-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 45bc997d0711..aec72fe8273c 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1978,7 +1978,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 			dev_err(&pdev->dev, "of_probe: name error(%d)\n", ret);
 			goto err;
 		}
-		ep->ep.name = kasprintf(GFP_KERNEL, "ep%d", ep->index);
+		ep->ep.name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "ep%d",
+					     ep->index);
 
 		ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
 		ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
-- 
2.10.2

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

end of thread, other threads:[~2017-01-16 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 10:26 [PATCH] usb: gadget: udc: atmel: used managed kasprintf Alexandre Belloni
2016-12-01 11:20 ` Nicolas Ferre
2016-12-02 15:59 ` David Laight
2016-12-02 16:19   ` Alexandre Belloni
2016-12-05 17:17     ` David Laight
2017-01-16 10:27       ` Felipe Balbi
2017-01-16 11:11         ` Alexandre Belloni
2017-01-16 11:19           ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).