From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Joe Perches <joe@perches.com>,
mingo@kernel.org, marc.zyngier@arm.com,
linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
geert+renesas@glider.be, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:irq/core] genirq/irqdomain: Remove WARN_ON() on out-of-memory condition
Date: Tue, 28 May 2019 18:00:02 -0500 [thread overview]
Message-ID: <4d89c9da-be5e-34ac-3334-3f1c01576182@embeddedor.com> (raw)
In-Reply-To: <3598cd48fe0c7c8c7155baf56f965c53a88eb067.camel@perches.com>
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
prev parent reply other threads:[~2019-05-28 23:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 11:57 [PATCH] " 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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d89c9da-be5e-34ac-3334-3f1c01576182@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=geert+renesas@glider.be \
--cc=hpa@zytor.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®