From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: fbdev/offb: fix PCI device reference leak on probe failure
Date: Thu, 23 Apr 2026 10:29:37 +1000 [thread overview]
Message-ID: <review-patch1-20260420010118.17960-1-dbgh9129@gmail.com> (raw)
In-Reply-To: <20260420010118.17960-1-dbgh9129@gmail.com>
Patch Review
**The bug:** In `offb_init_nodriver()`, the original code at line 642 was:
```c
pdev = pci_get_device(vid, did, NULL);
if (!pdev || pci_enable_device(pdev))
return;
```
`pci_get_device()` increments the device's reference count. When `pdev` is non-NULL but `pci_enable_device()` fails, the function returned without calling `pci_dev_put(pdev)`, leaking the reference.
**The fix:** The patch correctly splits the condition:
```c
pdev = pci_get_device(vid, did, NULL);
if (!pdev)
return;
if (pci_enable_device(pdev)) {
pci_dev_put(pdev);
return;
}
```
This ensures the reference is released on the `pci_enable_device()` failure path while keeping the `!pdev` case unchanged (no reference to release).
**Observation (pre-existing issue, not a problem with this patch):** On the *success* path, `pdev` is also never released. After `pci_enable_device()` succeeds, execution falls through to `offb_init_fb()` at line 655, which does not receive or store `pdev`. The reference from `pci_get_device()` is leaked on the success path too. This is outside the scope of this patch, but worth noting as a potential follow-up fix — the function would need a `pci_dev_put(pdev)` after the `pci_enable_device()` block completes (the device remains enabled even after the reference is dropped).
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-04-23 0:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 1:01 [PATCH v1] fbdev/offb: fix PCI device reference leak on probe failure Yuho Choi
2026-04-23 0:29 ` Claude review: " Claude Code Review Bot
2026-04-23 0:29 ` Claude Code Review Bot [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=review-patch1-20260420010118.17960-1-dbgh9129@gmail.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/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