diff mbox series

usb: dwc3: pci: prevent memory leak in dwc3_pci_probe

Message ID 20190930024147.25243-1-navid.emamdoost@gmail.com (mailing list archive)
State Mainlined
Commit 9bbfceea12a8f145097a27d7c7267af25893c060
Headers show
Series usb: dwc3: pci: prevent memory leak in dwc3_pci_probe | expand

Commit Message

Navid Emamdoost Sept. 30, 2019, 2:41 a.m. UTC
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 <navid.emamdoost@gmail.com>
---
 drivers/usb/dwc3/dwc3-pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Markus Elfring Sept. 30, 2019, 6:55 a.m. UTC | #1
> … This commit replaces return with the goto.

How do you think about to omit the wording “This commit” from your change descriptions?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=97f9a3c4eee55b0178b518ae7114a6a53372913d#n151

Regards,
Markus
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 5e8e18222f92..023f0357efd7 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -258,7 +258,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)