[lkml]   [2022]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] usb: fotg210-udc: fix potential memory leak in fotg210_udc_probe()
On Fri, Dec 2, 2022 at 2:25 AM Yi Yang <> wrote:

> 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: 718a38d092ec ("fotg210-udc: Handle PCLK")
> Signed-off-by: Yi Yang <>
> Reviewed-by: Andrzej Pietrasiewicz <>

Reviewed-by: Linus Walleij <>

I have some cleanup patches switching around to devm* handling
cooking for v6.3, but let's do this for now.

Linus Walleij

 \ /
  Last update: 2022-12-03 10:42    [W:0.106 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site