Linux USB
 help / color / mirror / Atom feed
* [PATCH v2] usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()
@ 2023-04-20 14:08 Li Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Li Yang @ 2023-04-20 14:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi, Sergey Shtylyov
  Cc: hust-os-kernel-patches, Li Yang, Dongliang Mu, linux-usb,
	linux-kernel

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>
---
v1->v2: Remove unnecessary dev_err().
The issue is found by static analysis, and the patch is remains untested.
---
 drivers/usb/phy/phy-tahvo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index f2d2cc586c5b..da63d7e4d270 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -391,7 +391,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
 
 	tu->irq = ret = platform_get_irq(pdev, 0);
 	if (ret < 0)
-		return ret;
+		goto err_remove_phy;
 	ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
 				   IRQF_ONESHOT,
 				   "tahvo-vbus", tu);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-25  5:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <644741EB.013E97.00008@m126.mail.126.com>
2023-04-25  5:15 ` [PATCH v2] usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe() Greg KH
2023-04-25  5:32   ` Dongliang Mu
2023-04-25  5:50     ` Greg KH
2023-04-25  5:57       ` Dongliang Mu
2023-04-20 14:08 Li Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox