提交 426fa316 编写于 作者: M Marc Zyngier

irqdomain: Use struct_size() helper when allocating irqdomain

Instead of open-coding the size computation of struct irqdomain,
use the struct_size() helper instead.

This is going to be handy as we change the type of the revmap
array.
Signed-off-by: NMarc Zyngier <maz@kernel.org>
上级 4f86a06e
...@@ -150,7 +150,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, ...@@ -150,7 +150,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max))) (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max)))
return NULL; return NULL;
domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size), domain = kzalloc_node(struct_size(domain, revmap, size),
GFP_KERNEL, of_node_to_nid(to_of_node(fwnode))); GFP_KERNEL, of_node_to_nid(to_of_node(fwnode)));
if (!domain) if (!domain)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册