irqchip/stm32-exti: Use kzalloc_flex
Subsystems (2)
PATCH 1/1 irqchip/stm32-exti: Use kzalloc_flex
Simplifies allocations by using a flexible array member in these structs. No need for a second kfree.
Signed-off-by Rosen Penev <[email protected]>
--- drivers/irqchip/irq-stm32-exti.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/irqchip/irq-stm32-exti.c +3 -10
@@ -45,8 +45,8 @@ struct stm32_exti_chip_data {struct stm32_exti_host_data {void __iomem *base;struct device *dev; -struct stm32_exti_chip_data *chips_data;const struct stm32_exti_drv_data *drv_data; +struct stm32_exti_chip_data chips_data[]; };static const struct stm32_exti_bank stm32f4xx_exti_b1 = {
@@ -269,26 +269,20 @@ stm32_exti_host_data *stm32_exti_host_init(const struct stm32_exti_drv_data *dd, {struct stm32_exti_host_data *host_data; - host_data =kzalloc_obj (*host_data); + host_data =kzalloc_flex (*host_data, chips_data, dd->bank_nr);if (!host_data)return NULL ; host_data->drv_data = dd; - host_data->chips_data = kzalloc_objs(struct stm32_exti_chip_data, - dd->bank_nr); -if (!host_data->chips_data) - goto free_host_data; host_data->base =of_iomap (node,0 );if (!host_data->base) {pr_err ("%pOF: Unable to map registers\n" , node); - goto free_chips_data; + goto free_host_data; }return host_data; -free_chips_data: -kfree (host_data->chips_data); free_host_data:kfree (host_data);
@@ -389,7 +383,6 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data,irq_domain_remove (domain); out_unmap:iounmap (host_data->base); -kfree (host_data->chips_data);kfree (host_data);return ret; }
Signature · 1 line
2.53.0
Thomas Gleixner
maintainerOn Thu, Mar 19 2026 at 21:04, Rosen Penev wrote:
This is not a new submission. It's either V3 or a resend of V2. Please follow the documented process.
Also this still applies:
https://lore.kernel.org/87ms0erbx4.ffs@tglx
Quoted 1 line
Simplifies allocations by using a flexible array member in these structs.
Simplify ...
Quoted 1 line
No need for a second kfree.
That's redundant information and can be seen from the patch. No?
Thanks,
tglx