From: Myeonghun Pak <mhun512@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Myeonghun Pak <mhun512@gmail.com>,
Ijae Kim <ae878000@gmail.com>
Subject: [PATCH 2/2] tty: moxa: use pcim_enable_device()
Date: Sat, 1 Aug 2026 01:18:09 +0900 [thread overview]
Message-ID: <20260731161809.45066-2-mhun512@gmail.com> (raw)
In-Reply-To: <20260731161809.45066-1-mhun512@gmail.com>
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: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
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
prev parent reply other threads:[~2026-07-31 16:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 16:18 [PATCH 1/2] tty: moxa: unwind tty driver if PCI registration fails Myeonghun Pak
2026-07-31 16:18 ` Myeonghun Pak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260731161809.45066-2-mhun512@gmail.com \
--to=mhun512@gmail.com \
--cc=ae878000@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox