]> git.baikalelectronics.ru Git - kernel.git/commit
usb: cdns3: gadget: fix possible memory leak
authorPeter Chen <peter.chen@nxp.com>
Fri, 21 Aug 2020 02:55:47 +0000 (10:55 +0800)
committerFelipe Balbi <balbi@kernel.org>
Fri, 2 Oct 2020 06:57:42 +0000 (09:57 +0300)
commit55129f07d5c30f0069e76901cb77d8af505ce338
treed25fcc1fce26d163a1c98a2c67df2c211f1279ac
parent7a45afd713c94fdcda5a3d0a93fe878c9e4f4aa3
usb: cdns3: gadget: fix possible memory leak

If cdns3_gadget_start is failed, it never frees cdns3_device structure.
Meanwhile, there is no release function for gadget device, it causes
there is no sync with driver core.

To fix this, we add release function for gadget device, and free
cdns3_device structure at there. Meanwhile, With the new UDC core
APIs, we could work with driver core better to handle memory leak
issue.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/cdns3/gadget.c