[PATCH 2/2] tty: moxa: use pcim_enable_device()
Myeonghun Pak <[email protected]> Sat, 1 Aug 2026 01:18:09 +0900
| Newsgroups | org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
moxa_pci_probe() enables the PCI device with pci_enable_device(), but
its failure paths and remove callback do not disable it. Repeated bind
and unbind cycles can therefore leave the PCI enable count unbalanced.
Use pcim_enable_device() so the PCI core automatically disables the
device when probe fails or the driver detaches. Keep the existing
explicit BAR request and mapping cleanup unchanged.
This issue was identified during our ongoing static-analysis research while
reviewing kernel code.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: [email protected]
Co-developed-by: Ijae Kim <[email protected]>
Signed-off-by: Ijae Kim <[email protected]>
Signed-off-by: Myeonghun Pak <[email protected]>
---
drivers/tty/moxa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 680b2dd65462..02220ecf3b38 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -1063,7 +1063,7 @@ static int moxa_pci_probe(struct pci_dev *pdev,
int board_type = ent->driver_data;
int retval;
- retval = pci_enable_device(pdev);
+ retval = pcim_enable_device(pdev);
if (retval) {
dev_err(&pdev->dev, "can't enable pci device\n");
goto err;
--
2.47.1