resource: Set type when reserving new regions
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 1 Dec 2017 20:07:18 +0000 (14:07 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 19 Dec 2017 05:07:47 +0000 (23:07 -0600)
Set resource structs inserted by __reserve_region_with_split() to have the
correct type.  Setting the type doesn't fix any functional problem but
makes %pR on the resource work better.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
kernel/resource.c

index ba3252f7c319da7060038d4d577e7f8a85d9a292..8c527d83ca7610cbd1d93d3435bb4b3acacd554f 100644 (file)
@@ -1022,6 +1022,7 @@ static void __init __reserve_region_with_split(struct resource *root,
        struct resource *conflict;
        struct resource *res = alloc_resource(GFP_ATOMIC);
        struct resource *next_res = NULL;
+       int type = resource_type(root);
 
        if (!res)
                return;
@@ -1029,7 +1030,7 @@ static void __init __reserve_region_with_split(struct resource *root,
        res->name = name;
        res->start = start;
        res->end = end;
-       res->flags = IORESOURCE_BUSY;
+       res->flags = type | IORESOURCE_BUSY;
        res->desc = IORES_DESC_NONE;
 
        while (1) {
@@ -1064,7 +1065,7 @@ static void __init __reserve_region_with_split(struct resource *root,
                                next_res->name = name;
                                next_res->start = conflict->end + 1;
                                next_res->end = end;
-                               next_res->flags = IORESOURCE_BUSY;
+                               next_res->flags = type | IORESOURCE_BUSY;
                                next_res->desc = IORES_DESC_NONE;
                        }
                } else {