[linux-6.6.y] ata: ahci: Fix Zhaoxin SATA LED quirk pci_dev refcount handling#1704
[linux-6.6.y] ata: ahci: Fix Zhaoxin SATA LED quirk pci_dev refcount handling#1704leoliu-oc wants to merge 1 commit into
Conversation
This patch fixes the Zhaoxin SATA LED quirk support by ensuring the pci_dev reference obtained from pci_get_device() is released in both ahci_zx_led_remove_quirk() and ahci_zx_led_init_quirk(). It also adds a pr_info() log when the Zhaoxin LED quirk is initialized, improving diagnostic visibility. Signed-off-by: LeoLiu-oc <leoliu-oc@zhaoxin.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes Zhaoxin SATA LED quirk reference counting by releasing pci_dev obtained via pci_get_device() in both init and remove paths, and adds a diagnostic log when the quirk is initialized. Sequence diagram for ahci_zx_led_init_quirk pci_dev refcount handlingsequenceDiagram
participant Kernel
participant ahci_zx_led_init_quirk
participant pci_get_device
participant sata_pdev
participant pci_dev_put
Kernel->>ahci_zx_led_init_quirk: ahci_zx_led_init_quirk(pdev, hpriv)
ahci_zx_led_init_quirk->>pci_get_device: pci_get_device(...)
pci_get_device-->>ahci_zx_led_init_quirk: sata_pdev
ahci_zx_led_init_quirk->>ahci_zx_led_init_quirk: rdmsr(...)
ahci_zx_led_init_quirk->>ahci_zx_led_init_quirk: pr_info(ahci: zx led quirk init)
ahci_zx_led_init_quirk->>ahci_zx_led_init_quirk: configure hpriv fields
ahci_zx_led_init_quirk->>sata_pdev: access PCI MMIO for LED quirk
ahci_zx_led_init_quirk->>pci_dev_put: pci_dev_put(sata_pdev)
pci_dev_put-->>ahci_zx_led_init_quirk: refcount decremented
ahci_zx_led_init_quirk-->>Kernel: return
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @leoliu-oc. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider using dev_info(&pdev->dev, ...) or pr_info_once() instead of a bare pr_info() for the zx LED quirk init message so the log is associated with the specific device and avoids spamming logs on systems with multiple controllers or repeated init paths.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider using dev_info(&pdev->dev, ...) or pr_info_once() instead of a bare pr_info() for the zx LED quirk init message so the log is associated with the specific device and avoids spamming logs on systems with multiple controllers or repeated init paths.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
This PR targets the Zhaoxin AHCI SATA LED quirk logic in drivers/ata/ahci.c, aiming to fix pci_dev reference handling around pci_get_device() iteration and to improve diagnostic visibility when the quirk is initialized.
Changes:
- Adds
pci_dev_put()calls afterpci_get_device()-based scans in both the quirk init and remove paths to avoid refcount leaks when the scan terminates early. - Adds an informational log message during Zhaoxin LED quirk initialization.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (sata_pdev) | ||
| pci_dev_put(sata_pdev); | ||
|
|
||
| if (target_p0_dev) { | ||
| sata_host = pci_get_drvdata(target_p0_dev); |
| pr_info("ahci: zx led quirk init\n"); | ||
|
|
This patch fixes the Zhaoxin SATA LED quirk support by ensuring the pci_dev reference obtained from pci_get_device() is released in both ahci_zx_led_remove_quirk() and ahci_zx_led_init_quirk().
It also adds a pr_info() log when the Zhaoxin LED quirk is initialized, improving diagnostic visibility.
Summary by Sourcery
Fix Zhaoxin AHCI SATA LED quirk PCI device reference handling and improve logging for initialization diagnostics.
Bug Fixes:
Enhancements: