From patchwork Wed Jun 24 07:44:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 11622475 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 5DACA14F6 for ; Wed, 24 Jun 2020 07:45:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 503E0217BA for ; Wed, 24 Jun 2020 07:45:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390005AbgFXHpV (ORCPT ); Wed, 24 Jun 2020 03:45:21 -0400 Received: from mail.loongson.cn ([114.242.206.163]:35812 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389954AbgFXHpV (ORCPT ); Wed, 24 Jun 2020 03:45:21 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxD2qIBPNevCZJAA--.660S3; Wed, 24 Jun 2020 15:45:13 +0800 (CST) From: Tiezhu Yang To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Xuefeng Li Subject: [PATCH v3 01/14 RESEND] irqchip/ath79-misc: Fix potential resource leaks Date: Wed, 24 Jun 2020 15:44:58 +0800 Message-Id: <1592984711-3130-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1592984711-3130-1-git-send-email-yangtiezhu@loongson.cn> References: <1592984711-3130-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9DxD2qIBPNevCZJAA--.660S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Kw47trWfCFW5ZF4kXw17Awb_yoW8GF1DpF WUW39avrWfJr47XrsxC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YxBIdaVFxhVjvjDU0xZFpf9x0p E1xRrUUUUU= 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: 07ba4b061a79 ("irqchip/ath79-misc: Move the MISC driver from arch/mips/ath79/") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-ath79-misc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c index 3d641bb..53e0c50 100644 --- a/drivers/irqchip/irq-ath79-misc.c +++ b/drivers/irqchip/irq-ath79-misc.c @@ -133,7 +133,7 @@ static int __init ath79_misc_intc_of_init( { struct irq_domain *domain; void __iomem *base; - int irq; + int irq, ret; irq = irq_of_parse_and_map(node, 0); if (!irq) { @@ -144,18 +144,26 @@ static int __init ath79_misc_intc_of_init( base = of_iomap(node, 0); if (!base) { pr_err("Failed to get MISC IRQ registers\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err_irq_dispose; } domain = irq_domain_add_linear(node, ATH79_MISC_IRQ_COUNT, &misc_irq_domain_ops, base); if (!domain) { pr_err("Failed to add MISC irqdomain\n"); - return -EINVAL; + ret = -EINVAL; + goto err_iounmap; } ath79_misc_intc_domain_init(domain, irq); return 0; + +err_iounmap: + iounmap(base); +err_irq_dispose: + irq_dispose_mapping(irq); + return ret; } static int __init ar7100_misc_intc_of_init(