linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of/address: use atomic allocation in pci_register_io_range()
@ 2015-06-17 15:12 Jingoo Han
  2015-06-23 15:29 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Jingoo Han @ 2015-06-17 15:12 UTC (permalink / raw)
  To: 'Grant Likely', 'Rob Herring'
  Cc: devicetree, 'Liviu Dudau', 'Bjorn Helgaas',
	linux-pci, '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()

Signed-off-by: Jingoo Han <jingoohan1@gmail.com>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] of/address: use atomic allocation in pci_register_io_range()
  2015-06-17 15:12 [PATCH] of/address: use atomic allocation in pci_register_io_range() Jingoo Han
@ 2015-06-23 15:29 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2015-06-23 15:29 UTC (permalink / raw)
  To: Jingoo Han
  Cc: Grant Likely, Rob Herring, devicetree, Liviu Dudau,
	Bjorn Helgaas, linux-pci

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
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-23 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 15:12 [PATCH] of/address: use atomic allocation in pci_register_io_range() Jingoo Han
2015-06-23 15:29 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).