From patchwork Wed Jun 24 07:29:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 11622467 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 D140414E3 for ; Wed, 24 Jun 2020 07:36:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8DF82084D for ; Wed, 24 Jun 2020 07:36:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389715AbgFXHg1 (ORCPT ); Wed, 24 Jun 2020 03:36:27 -0400 Received: from mail.loongson.cn ([114.242.206.163]:33302 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389583AbgFXHg1 (ORCPT ); Wed, 24 Jun 2020 03:36:27 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx_93mAPNezSRJAA--.399S8; Wed, 24 Jun 2020 15:29:46 +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 06/14] irqchip/digicolor: Fix potential resource leaks Date: Wed, 24 Jun 2020 15:29:34 +0800 Message-Id: <1592983782-8842-7-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--.399S8 X-Coremail-Antispam: 1UD129KBjvJXoW7ZFy3Cr4fWF17Zw1k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2z280aVCY1x02 67AKxVWxJr0_GcJvcSsGvfC2KfnxnUUI43ZEXa7VUjNB_UUUUUU== 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: 8041dfbd31cf ("irqchip: Conexant CX92755 interrupts controller driver") Signed-off-by: Tiezhu Yang --- drivers/irqchip/irq-digicolor.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-digicolor.c b/drivers/irqchip/irq-digicolor.c index fc38d2d..18c6e77 100644 --- a/drivers/irqchip/irq-digicolor.c +++ b/drivers/irqchip/irq-digicolor.c @@ -89,7 +89,8 @@ static int __init digicolor_of_init(struct device_node *node, ucregs = syscon_regmap_lookup_by_phandle(node, "syscon"); if (IS_ERR(ucregs)) { pr_err("%pOF: unable to map UC registers\n", node); - return PTR_ERR(ucregs); + ret = PTR_ERR(ucregs); + goto err_iounmap; } /* channel 1, regular IRQs */ regmap_write(ucregs, UC_IRQ_CONTROL, 1); @@ -98,7 +99,8 @@ static int __init digicolor_of_init(struct device_node *node, irq_domain_add_linear(node, 64, &irq_generic_chip_ops, NULL); if (!digicolor_irq_domain) { pr_err("%pOF: unable to create IRQ domain\n", node); - return -ENOMEM; + ret = -ENOMEM; + goto err_iounmap; } ret = irq_alloc_domain_generic_chips(digicolor_irq_domain, 32, 1, @@ -106,7 +108,7 @@ static int __init digicolor_of_init(struct device_node *node, clr, 0, 0); if (ret) { pr_err("%pOF: unable to allocate IRQ gc\n", node); - return ret; + goto err_domain_remove; } digicolor_set_gc(reg_base, 0, IC_INT0ENABLE_LO, IC_FLAG_CLEAR_LO); @@ -115,5 +117,11 @@ static int __init digicolor_of_init(struct device_node *node, set_handle_irq(digicolor_handle_irq); return 0; + +err_domain_remove: + irq_domain_remove(digicolor_irq_domain); +err_iounmap: + iounmap(reg_base); + return ret; } IRQCHIP_DECLARE(conexant_digicolor_ic, "cnxt,cx92755-ic", digicolor_of_init);