While I tracked an another bug, I noticed that the PCI command register is quite often updated here unnecessarily. Signed-off-by: Zoltan Kiss <zoltan.kiss@xxxxxxxxxx> --- drivers/pci/probe.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 46ada5c..54f6bec 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -178,8 +178,12 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, /* No printks while decoding is disabled! */ if (!dev->mmio_always_on) { pci_read_config_word(dev, PCI_COMMAND, &orig_cmd); - pci_write_config_word(dev, PCI_COMMAND, - orig_cmd & ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO)); + if (orig_cmd & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO)) { + pci_write_config_word(dev, + PCI_COMMAND, + orig_cmd & + ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO)); + } } res->name = pci_name(dev); @@ -293,7 +297,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, fail: res->flags = 0; out: - if (!dev->mmio_always_on) + if (!dev->mmio_always_on && + (orig_cmd & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO))) pci_write_config_word(dev, PCI_COMMAND, orig_cmd); if (bar_too_big) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html