From: sashiko-bot@kernel.org
To: "Yazen Ghannam" <yazen.ghannam@amd.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word()
Date: Fri, 04 Dec 2026 18:35:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-250429@kernel.org> (raw)
In-Reply-To: <20261204181556.1418843-3-yazen.ghannam@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] PCI: pci_clear_and_set_config_word() ignores
pci_read_config_word() error
--
commit 6deeae1d914f6910d535248cb7317e53525dce50
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI: Add pci_clear_and_set_config_word()
This commit adds pci_clear_and_set_config_word() to drivers/pci/access.c
and declares it in drivers/pci/pci.h for internal PCI core use.
> diff --git a/drivers/pci/access.c b/drivers/pci/access.c
> index b123da16b63ba..38619bc9c7f91 100644
> --- a/drivers/pci/access.c
> +++ b/drivers/pci/access.c
> @@ -613,6 +613,17 @@ int pci_write_config_dword(const struct pci_dev *dev, int where,
> }
> EXPORT_SYMBOL(pci_write_config_dword);
>
> +void pci_clear_and_set_config_word(const struct pci_dev *dev, int pos,
> + u16 clear, u16 set)
> +{
> + u16 val;
> +
> + pci_read_config_word(dev, pos, &val);
> + val &= ~clear;
> + val |= set;
> + pci_write_config_word(dev, pos, val);
> +}
[Severity: Medium]
Should pci_clear_and_set_config_word() check the return value of
pci_read_config_word() before writing back?
When bus->ops->read() fails transiently (for example,
dw_pcie_rd_other_conf() returning PCIBIOS_SET_FAILED), PCI_OP_READ()
populates val with 0xffff via PCI_SET_ERROR_RESPONSE().
Because pci_write_config_word() only skips the write when
pci_dev_is_disconnected(dev) is true, a succeeding write programs
(0xffff & ~clear) | set into the register, setting all unmasked bits to 1
and clearing any RW1C bits in that word.
Sibling helpers such as pcie_capability_clear_and_set_word_unlocked()
check the read return value and abort before writing.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com?part=2
next prev parent reply other threads:[~2026-12-04 18:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
2026-12-04 18:15 ` [PATCH v3 1/6] PCI/portdrv: Group PCI Exp Cap services into a single mask Yazen Ghannam
2026-12-04 18:15 ` [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word() Yazen Ghannam
2026-12-04 18:35 ` sashiko-bot [this message]
2026-12-04 18:15 ` [PATCH v3 3/6] PCI/FLIT: Add support for Flit Logging Extended Capability Yazen Ghannam
2026-12-04 18:42 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 4/6] PCI/FLIT: Add support for the Extended Flit Error Counter Yazen Ghannam
2026-12-04 18:40 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 5/6] PCI/FLIT: Signal Flit Error Counter events with ERR_COR Yazen Ghannam
2026-12-04 18:46 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 6/6] PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports Yazen Ghannam
2026-12-04 18:53 ` sashiko-bot
2026-12-04 18:53 ` [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support sashiko-bot
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=sashiko-outbox-250429@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yazen.ghannam@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.