linux-stable/drivers/usb/fotg210
Yi Yang 0cd142b466 usb: fotg210-udc: fix potential memory leak in fotg210_udc_probe()
In fotg210_udc_probe(), if devm_clk_get() or clk_prepare_enable()
fails, 'fotg210' will not be freed, which will lead to a memory leak.
Fix it by moving kfree() to a proper location.

In addition,we can use "return -ENOMEM" instead of "goto err"
to simplify the code.

Fixes: 718a38d092 ("fotg210-udc: Handle PCLK")
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Yi Yang <yiyang13@huawei.com>
Link: https://lore.kernel.org/r/20221202012126.246953-1-yiyang13@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-08 16:45:58 +01:00
..
Kconfig usb: USB_FOTG210 should depend on ARCH_GEMINI 2022-11-22 17:25:06 +01:00
Makefile
fotg210-core.c usb: fotg2: add Gemini-specific handling 2022-11-11 10:18:56 +01:00
fotg210-hcd.c
fotg210-hcd.h
fotg210-udc.c usb: fotg210-udc: fix potential memory leak in fotg210_udc_probe() 2022-12-08 16:45:58 +01:00
fotg210-udc.h fotg210-udc: Handle PCLK 2022-11-22 17:25:23 +01:00
fotg210.h