From patchwork Wed Jun 24 07:29:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 11622445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AB246C1 for ; Wed, 24 Jun 2020 07:29:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79E292082F for ; Wed, 24 Jun 2020 07:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389792AbgFXH35 (ORCPT ); Wed, 24 Jun 2020 03:29:57 -0400 Received: from mail.loongson.cn ([114.242.206.163]:59688 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389635AbgFXH35 (ORCPT ); Wed, 24 Jun 2020 03:29:57 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx_93mAPNezSRJAA--.399S4; Wed, 24 Jun 2020 15:29:44 +0800 (CST) From: Tiezhu Yang To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring Cc: Huacai Chen , Jiaxun Yang , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mips@vger.kernel.org, Xuefeng Li Subject: [PATCH v3 02/14] irqchip/csky-apb-intc: Fix potential resource leaks Date: Wed, 24 Jun 2020 15:29:30 +0800 Message-Id: <1592983782-8842-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1592983782-8842-1-git-send-email-yangtiezhu@loongson.cn> References: <1592983782-8842-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9Dx_93mAPNezSRJAA--.399S4 X-Coremail-Antispam: 1UD129KBjvJXoW7tF1DWw18XF4Utr1U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xkF7I0E14v2 6F4UJVW0obIYCTnIWIevJa73UjIFyTuYvjfUjHUDDUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org There exists potential resource leaks in the error path, fix them. Fixes: edff1b4835b7 ("irqchip: add C-SKY APB bus interrupt controller") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-csky-apb-intc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-csky-apb-intc.c b/drivers/irqchip/irq-csky-apb-intc.c index 5a2ec43..11a35eb 100644 --- a/drivers/irqchip/irq-csky-apb-intc.c +++ b/drivers/irqchip/irq-csky-apb-intc.c @@ -118,7 +118,8 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent) &irq_generic_chip_ops, NULL); if (!root_domain) { pr_err("C-SKY Intc irq_domain_add failed.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_iounmap; } ret = irq_alloc_domain_generic_chips(root_domain, 32, 1, @@ -126,10 +127,17 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent) IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN, 0, 0); if (ret) { pr_err("C-SKY Intc irq_alloc_gc failed.\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_domain_remove; } return 0; + +err_domain_remove: + irq_domain_remove(root_domain); +err_iounmap: + iounmap(reg_base); + return ret; } static inline bool handle_irq_perbit(struct pt_regs *regs, u32 hwirq,