irqchip/wpcm450: Fix memory leak in wpcm450_aic_of_init()

Bugzilla: https://bugzilla.redhat.com/2114045

commit 4208d4faf36573a507b5e5de17abe342e9276759
Author: Wei Yongjun <weiyongjun1@huawei.com>
Date:   Tue Nov 15 09:25:32 2022 +0000

    irqchip/wpcm450: Fix memory leak in wpcm450_aic_of_init()

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

    Fixes: fead4dd496 ("irqchip: Add driver for WPCM450 interrupt controller")
    Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
    Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20221115092532.1704032-1-weiyongjun@huaweicloud.com

Signed-off-by: David Arcari <darcari@redhat.com>
This commit is contained in:
David Arcari 2023-03-17 08:56:17 -04:00
parent 73a3996af4
commit e1d0875cba
1 changed files with 1 additions and 0 deletions

View File

@ -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;
}