From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260420010118.17960-1-dbgh9129@gmail.com> References: <20260420010118.17960-1-dbgh9129@gmail.com> <20260420010118.17960-1-dbgh9129@gmail.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **The bug:** In `offb_init_nodriver()`, the original code at line 642 was: ```c pdev =3D 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 cal= ling `pci_dev_put(pdev)`, leaking the reference. **The fix:** The patch correctly splits the condition: ```c pdev =3D 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 d= oes not receive or store `pdev`. The reference from `pci_get_device()` is l= eaked on the success path too. This is outside the scope of this patch, but= worth noting as a potential follow-up fix =E2=80=94 the function would nee= d a `pci_dev_put(pdev)` after the `pci_enable_device()` block completes (th= e device remains enabled even after the reference is dropped). --- Generated by Claude Code Patch Reviewer