if (i >= 3 && bus->self->transparent)
                        continue;
 
-               /* If we are going to re-assign everything, mark the resource
-                * as unset and move it down to 0
+               /* If we're going to reassign everything, we can
+                * shrink the P2P resource to have size as being
+                * of 0 in order to save space.
                 */
                if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) {
                        res->flags |= IORESOURCE_UNSET;
-                       res->end -= res->start;
                        res->start = 0;
+                       res->end = -1;
                        continue;
                }
 
                pr_warning("PCI: Cannot allocate resource region "
                           "%d of PCI bridge %d, will remap\n", i, bus->number);
        clear_resource:
-               res->start = res->end = 0;
+               /* The resource might be figured out when doing
+                * reassignment based on the resources required
+                * by the downstream PCI devices. Here we set
+                * the size of the resource to be 0 in order to
+                * save more space.
+                */
+               res->start = 0;
+               res->end = -1;
                res->flags = 0;
        }