Skip to content

Commit 1ec39d2

Browse files
Yuuoniygregkh
authored andcommitted
usb: cdns3: Fix double resource release in cdns3_pci_probe
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 baeb66f commit 1ec39d2

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ static int cdns3_pci_probe(struct pci_dev *pdev,
9898
wrap = pci_get_drvdata(func);
9999
} else {
100100
wrap = kzalloc(sizeof(*wrap), GFP_KERNEL);
101-
if (!wrap) {
102-
pci_disable_device(pdev);
101+
if (!wrap)
103102
return -ENOMEM;
104-
}
105103
}
106104

107105
res = wrap->dev_res;
@@ -160,7 +158,6 @@ static int cdns3_pci_probe(struct pci_dev *pdev,
160158
/* register platform device */
161159
wrap->plat_dev = platform_device_register_full(&plat_info);
162160
if (IS_ERR(wrap->plat_dev)) {
163-
pci_disable_device(pdev);
164161
err = PTR_ERR(wrap->plat_dev);
165162
kfree(wrap);
166163
return err;

0 commit comments

Comments
 (0)