Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp227336ybt; Tue, 30 Jun 2020 19:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytm905GMwz49+99QI5NndySJnO4RnihgP859eiyTXJ45EcrYOeMG+WawPMcROf7mkMIYRJ X-Received: by 2002:a17:906:ca43:: with SMTP id jx3mr10034583ejb.208.1593570010416; Tue, 30 Jun 2020 19:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593570010; cv=none; d=google.com; s=arc-20160816; b=GrFd+p6QJCp3o4A4qZeDJIGBoMNZBcU6LDsgzvHemr9yns1XFQWs4mUZSz/tsgfS4D mIHjRub3KYfNqcRfeZppxw3Y/SEg83W61Fnq3z2xTXDHXXfuPcaa1OyfH7o8lgAHEYUi OhHfegv5yDX+xqFSCsnMfG4PQqzuI79sAkkcKUH2Mqstd0kbMX9Da6i7OO0ZNud5q3V+ JING3M6TNNRdCsKIoXXKNBWUVLB2eAKlINDJsRp+PdXXlRjYwYOrSmHKw+mR6VYFXu+a c9DFINemWRL3CnI9ZlgSLrWLWRNmZfJHnqH6nHD4mjrxIllp61zPN2ycJYdINEU01h/M HmIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=hNt8gTLcBcRv26J3eeVVGJXfCcidic5n5EhCWfcTNtw=; b=z2f4IlIKzK62X7Z2BaVXu4lnklp0RCEoWAIH4zeE0RmqURJdylkCNPfKm8zcL1EGPD hhZhcgU2we0hd/tT0Eil7XEfW1TVwbBe5gORO8YUzBLj06Rxi3RCrySSkrPo/a6xbrsD m5EnNlTcEF9ivjHDsQr8pGQNfOFomxQ54uRIpCaUaShLw9n4pnKEh0QiBWueXw6U798K kWfVGaosT16EusjivWFx4iAbhFe2NQ5YFASeI4KUCPbJ7Aq2Umu0wJcULnrzOG1x82de zsCa0so7j1XmKTiNyesuz2C+jxCNHGb0jRfDayL23sxaIukFXz74QrZDx372NjBQuTNQ ykMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dh14si2834360edb.591.2020.06.30.19.19.47; Tue, 30 Jun 2020 19:20:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726906AbgGACQx (ORCPT + 99 others); Tue, 30 Jun 2020 22:16:53 -0400 Received: from mail.loongson.cn ([114.242.206.163]:47714 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726744AbgGACQh (ORCPT ); Tue, 30 Jun 2020 22:16:37 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxz2r68fteU2dNAA--.5801S8; Wed, 01 Jul 2020 10:16:29 +0800 (CST) From: Tiezhu Yang To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Markus Elfring Subject: [PATCH v4 06/14] irqchip/digicolor: Fix potential resource leaks Date: Wed, 1 Jul 2020 10:16:18 +0800 Message-Id: <1593569786-11500-7-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1593569786-11500-1-git-send-email-yangtiezhu@loongson.cn> References: <1593569786-11500-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9Dxz2r68fteU2dNAA--.5801S8 X-Coremail-Antispam: 1UD129KBjv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YvjxUcRwZDUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the function digicolor_of_init(), system resources "reg_base" and "digicolor_irq_domain" were not released in a few error cases. Thus add jump targets for the completion of the desired exception handling. 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); -- 2.1.0