diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 8db2de2f4a906090b16ac8f8f9480b03fa9f62d2..dbcd674cd3320ce7d62be1d5095d11f42a23a900 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1369,7 +1369,7 @@ static void pci_restore_rebar_state(struct pci_dev *pdev) pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); bar_idx = ctrl & PCI_REBAR_CTRL_BAR_IDX; res = pdev->resource + bar_idx; - size = order_base_2((resource_size(res) >> 20) | 1) - 1; + size = ilog2(resource_size(res)) - 20; ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE; ctrl |= size << PCI_REBAR_CTRL_BAR_SHIFT; pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl);