All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition
@ 2019-05-27 11:57 Geert Uytterhoeven
  2019-05-28 20:23 ` [tip:irq/core] " tip-bot for Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-05-27 11:57 UTC (permalink / raw)
  To: Marc Zyngier, Thomas Gleixner; +Cc: linux-kernel, Geert Uytterhoeven

There is no need to print a backtrace when memory allocation fails, as
the memory allocation core already takes care of that.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index a453e229f99caf40..e7d17cc3a3d7bb76 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -139,7 +139,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
 
 	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
 			      GFP_KERNEL, of_node_to_nid(of_node));
-	if (WARN_ON(!domain))
+	if (!domain)
 		return NULL;
 
 	if (fwnode && is_fwnode_irqchip(fwnode)) {
-- 
2.17.1


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

* [tip:irq/core] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition
  2019-05-27 11:57 [PATCH] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition Geert Uytterhoeven
@ 2019-05-28 20:23 ` tip-bot for Geert Uytterhoeven
  2019-05-28 22:54   ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: tip-bot for Geert Uytterhoeven @ 2019-05-28 20:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, geert+renesas, marc.zyngier, tglx, linux-kernel, mingo

Commit-ID:  43b98d876f89dce732f50b71607b6d2bbb8d8e6a
Gitweb:     https://git.kernel.org/tip/43b98d876f89dce732f50b71607b6d2bbb8d8e6a
Author:     Geert Uytterhoeven <geert+renesas@glider.be>
AuthorDate: Mon, 27 May 2019 13:57:42 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 28 May 2019 13:10:55 -0700

genirq/irqdomain: Remove WARN_ON() on out-of-memory condition

There is no need to print a backtrace when memory allocation fails, as
the memory allocation core already takes care of that.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Link: https://lkml.kernel.org/r/20190527115742.2693-1-geert+renesas@glider.be

---
 kernel/irq/irqdomain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index a453e229f99c..e7d17cc3a3d7 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -139,7 +139,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
 
 	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
 			      GFP_KERNEL, of_node_to_nid(of_node));
-	if (WARN_ON(!domain))
+	if (!domain)
 		return NULL;
 
 	if (fwnode && is_fwnode_irqchip(fwnode)) {

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

* Re: [tip:irq/core] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition
  2019-05-28 20:23 ` [tip:irq/core] " tip-bot for Geert Uytterhoeven
@ 2019-05-28 22:54   ` Joe Perches
  2019-05-28 23:00     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2019-05-28 22:54 UTC (permalink / raw)
  To: mingo, marc.zyngier, linux-kernel, hpa, tglx, geert+renesas,
	linux-tip-commits
  Cc: Gustavo A. R. Silva

On Tue, 2019-05-28 at 13:23 -0700, tip-bot for Geert Uytterhoeven wrote:
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
[]
> @@ -139,7 +139,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
>  
>  	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
>  			      GFP_KERNEL, of_node_to_nid(of_node));
> -	if (WARN_ON(!domain))
> +	if (!domain)
>  		return NULL;
>  
>  	if (fwnode && is_fwnode_irqchip(fwnode)) {

This could also use the struct_size macro if desired.

Oddly, this seems to reduce object size (gcc 8.3.0)
but it's probably unrelated.

---
 kernel/irq/irqdomain.c | 2 +-.
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index e7d17cc3a3d7..93a984a82154 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -137,7 +137,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
 
 	static atomic_t unknown_domains;
 
-	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
+	domain = kzalloc_node(struct_size(domain, linear_revmap, size),
 			      GFP_KERNEL, of_node_to_nid(of_node));
 	if (!domain)
 		return NULL;



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

* Re: [tip:irq/core] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition
  2019-05-28 22:54   ` Joe Perches
@ 2019-05-28 23:00     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-05-28 23:00 UTC (permalink / raw)
  To: Joe Perches, mingo, marc.zyngier, linux-kernel, hpa, tglx,
	geert+renesas, linux-tip-commits



On 5/28/19 5:54 PM, Joe Perches wrote:
> On Tue, 2019-05-28 at 13:23 -0700, tip-bot for Geert Uytterhoeven wrote:
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> []
>> @@ -139,7 +139,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
>>  
>>  	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
>>  			      GFP_KERNEL, of_node_to_nid(of_node));
>> -	if (WARN_ON(!domain))
>> +	if (!domain)
>>  		return NULL;
>>  
>>  	if (fwnode && is_fwnode_irqchip(fwnode)) {
> 
> This could also use the struct_size macro if desired.
> 

ACK this.

> Oddly, this seems to reduce object size (gcc 8.3.0)
> but it's probably unrelated.
> 
> ---
>  kernel/irq/irqdomain.c | 2 +-.
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index e7d17cc3a3d7..93a984a82154 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -137,7 +137,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
>  
>  	static atomic_t unknown_domains;
>  
> -	domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
> +	domain = kzalloc_node(struct_size(domain, linear_revmap, size),
>  			      GFP_KERNEL, of_node_to_nid(of_node));
>  	if (!domain)
>  		return NULL;
> 
> 

--
Gustavo

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

end of thread, other threads:[~2019-05-28 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 11:57 [PATCH] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition Geert Uytterhoeven
2019-05-28 20:23 ` [tip:irq/core] " tip-bot for Geert Uytterhoeven
2019-05-28 22:54   ` Joe Perches
2019-05-28 23:00     ` Gustavo A. R. Silva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.