pci_reassigndev_resource_alignment() performs a PCI config read, then then unconditionally clears a bit and issues a PCI config write. However, the bit in question (PCI_COMMAND_MEMORY) is a RW bit, so it is unnecessary to issue the PCI config write if the bit is already cleared. Make the write conditional. Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx> --- Should this be folded into ("pci: restore memory decoding after reallocation") in this series? --- drivers/pci/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index df550953fa26..f017e7a8f028 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -6632,8 +6632,10 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) } pci_read_config_word(dev, PCI_COMMAND, &command); - command &= ~PCI_COMMAND_MEMORY; - pci_write_config_word(dev, PCI_COMMAND, command); + if (command & PCI_COMMAND_MEMORY) { + command &= ~PCI_COMMAND_MEMORY; + pci_write_config_word(dev, PCI_COMMAND, command); + } for (i = 0; i <= PCI_ROM_RESOURCE; i++) pci_request_resource_alignment(dev, i, align, resize); -- 2.45.2