[PATCH] PCI: sysfs: Suppress FW_BUG warning when NUMA node already matches

From: lirongqing

Date: Fri Mar 13 2026 - 01:09:44 EST


From: Li RongQing <lirongqing@xxxxxxxxx>

The numa_node sysfs interface allows users to manually override a PCI
device's NUMA node assignment. Currently, every write triggers a
FW_BUG warning and taints the kernel, even when writing the same value
that is already set.

Fix by comparing the new value against the existing dev->numa_node.
Only emit the warning and update the node when they differ. Writing
the same value becomes a harmless no-op.

Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
---
drivers/pci/pci-sysfs.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 16eaaf7..9f52410 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -378,11 +378,13 @@ static ssize_t numa_node_store(struct device *dev,
if (node != NUMA_NO_NODE && !node_online(node))
return -EINVAL;

- add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
- pci_alert(pdev, FW_BUG "Overriding NUMA node to %d. Contact your vendor for updates.",
- node);
+ if (node != dev->numa_node) {
+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
+ pci_alert(pdev, FW_BUG "Overriding NUMA node to %d. Contact your vendor for updates.",
+ node);
+ dev->numa_node = node;
+ }

- dev->numa_node = node;
return count;
}

--
2.9.4