Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp228860ybt; Tue, 30 Jun 2020 19:23:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytH/5Oq6jyKkJbG41ZO14XttPOLPTRWhJ5QA2tI8VeL3sWsNCS7A65QxDdKUPevGrx9l6K X-Received: by 2002:a05:6402:1592:: with SMTP id c18mr27221632edv.258.1593570198037; Tue, 30 Jun 2020 19:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593570198; cv=none; d=google.com; s=arc-20160816; b=kUp+za3+MYp2F7XGR22+2lKBYEp2ENw9v6N0+NyfdPJjtoC0ADW4oMRxk0/O6vSN1a Ci0zqp9XHwmBrc/ckTnAaivC+LczBYw4T0jnbLj5HVq2YGV5YLYTtGU9DCd3ln0sOVTN f1m6got/X7jpYxmYV+JZ51Ebc/+IbyFuUIIVI1ht68OU9cWY/ILfsi8AUR1CogPdb/B/ S6jwL+Yytmk75pnLzzWHQ5R90qytwUSEzIuty8En8TRq6cRvCigfkZqCpViT1UUqqnMT iIipvVz2MyZMwjdqEZQzrGZ61xBLCuOOVF7+EkyU71W5iji/n5vQzhW7/KoSOiWrrkOT 4QPg== 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=fQO8blIR9wNy5I1j0mr5McsoTtpv5p9iLEL+20scXIY=; b=EyfhFk7fUxCXmQLpb+cYSvgTtYNsjsVF7MX7gMkTg+kZLBl/XSdmhTKtlZAjCJqIy7 fs1cOMYqt+m+PB6Elcj39yQ4WKS/UlVVcRqOVCefc6A3ltGs8irjtyV1GfK3FzUrey5X PXsrDcWIgJl3sU1y5DwU7RZVROcdpEeAJ1N/VUHbtGCMbEKG85nbJ0G5wN+kE7qiBAfe o7iKJH8tROECEhS6wEhGUlFlp6tFyiZwiOzDCAhh8Ca1+JY/0DfHM1YrnimOaw6CRuhV RZh5E8s9uTSpON2E+3rQnoI0+xBrxSw+d6INHHzPsIkcaAevPsL0YB8StQdgCAA7KobN Lkqg== 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 w18si2900955edx.276.2020.06.30.19.22.55; Tue, 30 Jun 2020 19:23:18 -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 S1726444AbgGACWl (ORCPT + 99 others); Tue, 30 Jun 2020 22:22:41 -0400 Received: from mail.loongson.cn ([114.242.206.163]:49152 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725868AbgGACWk (ORCPT ); Tue, 30 Jun 2020 22:22:40 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxz2r68fteU2dNAA--.5801S4; Wed, 01 Jul 2020 10:16:27 +0800 (CST) From: Tiezhu Yang To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Markus Elfring Subject: [PATCH v4 02/14] irqchip/csky-apb-intc: Fix potential resource leaks Date: Wed, 1 Jul 2020 10:16:14 +0800 Message-Id: <1593569786-11500-3-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--.5801S4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AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7I U0b_-PUUUUU== 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 ck_intc_init_comm(), system resources "reg_base" and "root_domain" were not released in a few error cases. Thus add jump targets for the completion of the desired exception handling. 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, -- 2.1.0