Skip to contentSkip to conversation

of/address: use atomic allocation in pci_register_io_range()

PATCH Applied Jingoo Han 2 participants 2 messages Jun 17, 2015 – Jun 23, 2015

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 of/address: use atomic allocation in pci_register_io_range()

When kzalloc() is called under spin_lock(), GFP_ATOMIC should be used to avoid sleeping allocation.
The call tree is:
of_pci_range_to_resource()

    --> pci_register_io_range() <-- takes spin_lock(&io_range_lock);
       --> kzalloc()
---
 drivers/of/address.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/address.c +1 -1
index 78a7dcb..65c3289 100644
@@ -712,7 +712,7 @@ int __weak pci_register_io_range(phys_addr_t addr, resource_size_t size)
 	}
 
 	/* add the range to the list */
-	range = kzalloc(sizeof(*range), GFP_KERNEL);
+	range = kzalloc(sizeof(*range), GFP_ATOMIC);
 	if (!range) {
 		err = -ENOMEM;
 		goto end_register;
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 8 lines · Jingoo Han

When kzalloc() is called under spin_lock(), GFP_ATOMIC should be used to avoid sleeping allocation.
The call tree is:
of_pci_range_to_resource()

    --> pci_register_io_range() <-- takes spin_lock(&io_range_lock);
       --> kzalloc()

Applied. Thanks.

Rob

Quoted 21 lines
---
 drivers/of/address.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/address.c +1 -2
index 78a7dcb..65c3289 100644
@@ -712,7 +712,7 @@ int __weak pci_register_io_range(phys_addr_t addr, resource_size_t size)
        }
 
        /* add the range to the list */
-       range = kzalloc(sizeof(*range), GFP_KERNEL);
+       range = kzalloc(sizeof(*range), GFP_ATOMIC);
        if (!range) {
                err = -ENOMEM;
                goto end_register;
--

1.9.1