Skip to content

Commit 7712421

Browse files
Yuuoniygregkh
authored andcommitted
usb: cdns3: Fix double resource release in cdns3_pci_probe
commit 1ec39d2 upstream. The driver uses pcim_enable_device() to enable the PCI device, the device will be automatically disabled on driver detach through the managed device framework. The manual pci_disable_device() calls in the error paths are therefore redundant and should be removed. Found via static anlaysis and this is similar to commit 99ca0b5 ("thermal: intel: int340x: processor: Fix warning during module unload"). Fixes: 7733f6c ("usb: cdns3: Add Cadence USB3 DRD Driver") Cc: stable <stable@kernel.org> Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Acked-by: Peter Chen <peter.chen@kernel.org> Link: https://patch.msgid.link/20251026090859.33107-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2274767 commit 7712421

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/usb/cdns3/cdns3-pci-wrap.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ static int cdns3_pci_probe(struct pci_dev *pdev,
100100
wrap = pci_get_drvdata(func);
101101
} else {
102102
wrap = kzalloc(sizeof(*wrap), GFP_KERNEL);
103-
if (!wrap) {
104-
pci_disable_device(pdev);
103+
if (!wrap)
105104
return -ENOMEM;
106-
}
107105
}
108106

109107
res = wrap->dev_res;
@@ -162,7 +160,6 @@ static int cdns3_pci_probe(struct pci_dev *pdev,
162160
/* register platform device */
163161
wrap->plat_dev = platform_device_register_full(&plat_info);
164162
if (IS_ERR(wrap->plat_dev)) {
165-
pci_disable_device(pdev);
166163
err = PTR_ERR(wrap->plat_dev);
167164
kfree(wrap);
168165
return err;

0 commit comments

Comments
 (0)