blob: 7076c1b70d6dd4da9da2c7c157a92738a40b176c [file] [log] [blame]
From bd2b77f569e48db4bec5e8a1a05478073c4d02a0 Mon Sep 17 00:00:00 2001
From: Navid Emamdoost <>
Date: Sun, 29 Sep 2019 21:41:45 -0500
Subject: [PATCH] usb: dwc3: pci: prevent memory leak in dwc3_pci_probe
commit 9bbfceea12a8f145097a27d7c7267af25893c060 upstream.
In dwc3_pci_probe a call to platform_device_alloc allocates a device
which is correctly put in case of error except one case: when the call to
platform_device_add_properties fails it directly returns instead of
going to error handling. This commit replaces return with the goto.
Fixes: 1a7b12f69a94 ("usb: dwc3: pci: Supply device properties via driver data")
Signed-off-by: Navid Emamdoost <>
Signed-off-by: Felipe Balbi <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 8cced3609e24..b4e42d597211 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -256,7 +256,7 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
ret = platform_device_add_properties(dwc->dwc3, p);
if (ret < 0)
- return ret;
+ goto err;
ret = dwc3_pci_quirks(dwc);
if (ret)