From: Myeonghun Pak <mhun512@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Oliver Endriss <o.endriss@gmx.de>,
Ralph Metzler <rmetzler@digitaldevices.de>,
Daniel Scheller <d.scheller@gmx.net>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Ijae Kim <ae878000@gmail.com>
Subject: [PATCH] media: ddbridge: Disable PCI device on early probe failures
Date: Sun, 13 Sep 2026 21:37:00 -0400 [thread overview]
Message-ID: <20260914013700.51804-1-mhun512@gmail.com> (raw)
The DMA mask and device allocation failure paths return directly after
pci_enable_device(), leaving its enable count unbalanced.
Route both failures to the existing PCI disable step, after the cleanup
that requires an allocated device object. Preserve the existing error
codes and successful probe and removal behavior.
This issue was identified during our ongoing static-analysis research
while reviewing kernel code.
Fixes: ccad04578fcb ("[media] ddbridge: Initial check-in")
Fixes: 22e743898dcd ("media: ddbridge: bump ddbridge code to version 0.9.29")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Assisted-by: OpenAI:GPT-5.6
---
Validated with an ARM64 W=1 object build and strict checkpatch.
No hardware runtime or probe-failure injection testing was performed.
diff --git a/drivers/media/pci/ddbridge/ddbridge-main.c b/drivers/media/pci/ddbridge/ddbridge-main.c
index 248ace2..591a43e 100644
--- a/drivers/media/pci/ddbridge/ddbridge-main.c
+++ b/drivers/media/pci/ddbridge/ddbridge-main.c
@@ -172,12 +172,16 @@ static int ddb_probe(struct pci_dev *pdev,
pci_set_master(pdev);
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))
- if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)))
- return -ENODEV;
+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+ stat = -ENODEV;
+ goto fail_disable_device;
+ }
dev = vzalloc(sizeof(*dev));
- if (!dev)
- return -ENOMEM;
+ if (!dev) {
+ stat = -ENOMEM;
+ goto fail_disable_device;
+ }
mutex_init(&dev->mutex);
dev->has_dma = 1;
@@ -237,6 +241,7 @@ fail:
ddb_unmap(dev);
pci_set_drvdata(pdev, NULL);
+fail_disable_device:
pci_disable_device(pdev);
return stat;
}
reply other threads:[~2026-09-14 1:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260914013700.51804-1-mhun512@gmail.com \
--to=mhun512@gmail.com \
--cc=ae878000@gmail.com \
--cc=d.scheller@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=o.endriss@gmx.de \
--cc=rmetzler@digitaldevices.de \
/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
all inboxes | Powered by JetHome®