diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2020-06-17 01:09:23 +0200 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2020-06-27 12:55:29 +0200 |
commit | 2f7a9bda42f74e1169fcd9ef55c8ade989ef8bba (patch) | |
tree | 2a90ba2cea9b528d227e76c21790ec8b9b80eb47 /drivers/irqchip | |
parent | irqchip/irq-mtk-sysirq: Replace spinlock with raw_spinlock (diff) | |
download | linux-2f7a9bda42f74e1169fcd9ef55c8ade989ef8bba.tar.xz linux-2f7a9bda42f74e1169fcd9ef55c8ade989ef8bba.zip |
irqchip/imx-intmux: Use struct_size() helper in devm_kzalloc()
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
This code was detected with the help of Coccinelle and, audited and
fixed manually.
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200616230923.GA24937@embeddedor
Diffstat (limited to 'drivers/irqchip')
-rw-r--r-- | drivers/irqchip/irq-imx-intmux.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c index c27577c81126..54d8bb4fc5a1 100644 --- a/drivers/irqchip/irq-imx-intmux.c +++ b/drivers/irqchip/irq-imx-intmux.c @@ -210,8 +210,7 @@ static int imx_intmux_probe(struct platform_device *pdev) return -EINVAL; } - data = devm_kzalloc(&pdev->dev, sizeof(*data) + - channum * sizeof(data->irqchip_data[0]), GFP_KERNEL); + data = devm_kzalloc(&pdev->dev, struct_size(data, irqchip_data, channum), GFP_KERNEL); if (!data) return -ENOMEM; |