Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()

Smatch reports:
drivers/usb/phy/phy-tahvo.c: tahvo_usb_probe()
warn: missing unwind goto?

After geting irq, if ret < 0, it will return without error handling to
free memory.
Just add error handling to fix this problem.

Fixes: 0d45a1373e66 ("usb: phy: tahvo: add IRQ check")
Signed-off-by: Li Yang <lidaxian@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/r/20230420140832.9110-1-lidaxian@hust.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Li Yang and committed by
Greg Kroah-Hartman
342161c1 4a680fcd

+1 -1
+1 -1
drivers/usb/phy/phy-tahvo.c
··· 391 391 392 392 tu->irq = ret = platform_get_irq(pdev, 0); 393 393 if (ret < 0) 394 - return ret; 394 + goto err_remove_phy; 395 395 ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt, 396 396 IRQF_ONESHOT, 397 397 "tahvo-vbus", tu);