Skip to content
Commit 0cd142b4 authored by Yi Yang's avatar Yi Yang Committed by Greg Kroah-Hartman
Browse files

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: 718a38d0 ("fotg210-udc: Handle PCLK")
Reviewed-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarYi Yang <yiyang13@huawei.com>
Link: https://lore.kernel.org/r/20221202012126.246953-1-yiyang13@huawei.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 59d54aa0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment