diff mbox

of/address: use atomic allocation in pci_register_io_range()

Message ID 000301d0a910$09d9bd60$1d8d3820$@com
State Not Applicable
Headers show

Commit Message

Han Jingoo June 17, 2015, 3:12 p.m. UTC
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()

Signed-off-by: Jingoo Han <jingoohan1@gmail.com>
---
 drivers/of/address.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rob Herring June 23, 2015, 3:29 p.m. UTC | #1
On Wed, Jun 17, 2015 at 10:12 AM, Jingoo Han <jingoohan1@gmail.com> wrote:
> 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()
>
> Signed-off-by: Jingoo Han <jingoohan1@gmail.com>

Applied. Thanks.

Rob

> ---
>  drivers/of/address.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index 78a7dcb..65c3289 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -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
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 78a7dcb..65c3289 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -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;