diff mbox series

usb: gadget: net2272: Fix a memory leak in an error handling path in 'net2272_plat_probe()'

Message ID 20200427180423.88514-1-christophe.jaillet@wanadoo.fr (mailing list archive)
State Mainlined
Commit ccaef7e6e354fb65758eaddd3eae8065a8b3e295
Headers show
Series usb: gadget: net2272: Fix a memory leak in an error handling path in 'net2272_plat_probe()' | expand

Commit Message

Christophe JAILLET April 27, 2020, 6:04 p.m. UTC
'dev' is allocated in 'net2272_probe_init()'. It must be freed in the error
handling path, as already done in the remove function (i.e.
'net2272_plat_remove()')

Fixes: 90fccb529d24 ("usb: gadget: Gadget directory cleanup - group UDC drivers")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/usb/gadget/udc/net2272.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index a8273b589456..5af0fe9c61d7 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -2647,6 +2647,8 @@  net2272_plat_probe(struct platform_device *pdev)
  err_req:
 	release_mem_region(base, len);
  err:
+	kfree(dev);
+
 	return ret;
 }