-@@ -74,8 +106,7 @@ static int dw_pcie_ep_inbound_atu(struct
- u32 free_win;
- struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
-
-- free_win = find_first_zero_bit(&ep->ib_window_map,
-- sizeof(ep->ib_window_map));
-+ free_win = find_first_zero_bit(ep->ib_window_map, ep->num_ib_windows);
- if (free_win >= ep->num_ib_windows) {
- dev_err(pci->dev, "no free inbound window\n");
- return -EINVAL;
-@@ -89,7 +120,7 @@ static int dw_pcie_ep_inbound_atu(struct
- }
-
- ep->bar_to_atu[bar] = free_win;
-- set_bit(free_win, &ep->ib_window_map);
-+ set_bit(free_win, ep->ib_window_map);
-
- return 0;
- }
-@@ -100,8 +131,7 @@ static int dw_pcie_ep_outbound_atu(struc
- u32 free_win;
- struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
-
-- free_win = find_first_zero_bit(&ep->ob_window_map,
-- sizeof(ep->ob_window_map));
-+ free_win = find_first_zero_bit(ep->ob_window_map, ep->num_ob_windows);
- if (free_win >= ep->num_ob_windows) {
- dev_err(pci->dev, "no free outbound window\n");
- return -EINVAL;
-@@ -110,30 +140,35 @@ static int dw_pcie_ep_outbound_atu(struc
- dw_pcie_prog_outbound_atu(pci, free_win, PCIE_ATU_TYPE_MEM,
- phys_addr, pci_addr, size);
-
-- set_bit(free_win, &ep->ob_window_map);
-+ set_bit(free_win, ep->ob_window_map);
- ep->outbound_addr[free_win] = phys_addr;
-