public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/wpcm450: fix memory leak in ap_init_qci_info()
@ 2022-11-14 11:08 Wei Yongjun
  2022-11-15  8:36 ` Jonathan Neuschäfer
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2022-11-14 11:08 UTC (permalink / raw)
  To: Jonathan Neuschäfer, Thomas Gleixner, Marc Zyngier
  Cc: Wei Yongjun, openbmc, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.com>

If of_iomap() failed, 'aic' should be freed before return. Otherwise
there is a memory leak.

Fixes: fead4dd49663 ("irqchip: Add driver for WPCM450 interrupt controller")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/irqchip/irq-wpcm450-aic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-wpcm450-aic.c b/drivers/irqchip/irq-wpcm450-aic.c
index 0dcbeb1a05a1..91df62a64cd9 100644
--- a/drivers/irqchip/irq-wpcm450-aic.c
+++ b/drivers/irqchip/irq-wpcm450-aic.c
@@ -146,6 +146,7 @@ static int __init wpcm450_aic_of_init(struct device_node *node,
 	aic->regs = of_iomap(node, 0);
 	if (!aic->regs) {
 		pr_err("Failed to map WPCM450 AIC registers\n");
+		kfree(aic);
 		return -ENOMEM;
 	}
 
-- 
2.34.1


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

end of thread, other threads:[~2022-11-15  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 11:08 [PATCH] irqchip/wpcm450: fix memory leak in ap_init_qci_info() Wei Yongjun
2022-11-15  8:36 ` Jonathan Neuschäfer
2022-11-15  9:10   ` Wei Yongjun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox