]> www.infradead.org Git - users/hch/block.git/commitdiff
usb: dwc3: pci: prevent memory leak in dwc3_pci_probe
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Mon, 30 Sep 2019 02:41:45 +0000 (21:41 -0500)
committerFelipe Balbi <balbi@kernel.org>
Sun, 27 Oct 2019 06:58:45 +0000 (08:58 +0200)
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>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/dwc3-pci.c

index 5e8e18222f922c00a646063b91599be7100feb41..023f0357efd77eae3182aaf596120b8a8847fa8b 100644 (file)
@@ -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)