Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2633683ybh; Mon, 16 Mar 2020 06:56:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsKwoboxlCSOniTqHzWp9lwqA1VOhMkFlM9uesqqGQ5ufsnLZ9LRMf4vkuGrvKrK7q/MBrI X-Received: by 2002:aca:d44d:: with SMTP id l74mr7193738oig.83.1584367006986; Mon, 16 Mar 2020 06:56:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1584367006; cv=pass; d=google.com; s=arc-20160816; b=LT7LR4kK4I7N6eG3CHFoI6rMt7JFuyKZW3G/vGPKOH8TIyT2zaFiyeOYpti2IjyuEM MYyKT4DULJuaW29gA0U/MJV8yyMlDzl2FyrfVWFjEU3GsQ+cVfe+QDBf6lUUrU/TvZAj RWBODyEIFxCqmX+Q6irGhmFPQ2VAbk8BMJK2Z6EUzzhxs4KTT9AW2MwzKe7uh+0Pt+38 qatpYxXuZKwDetlI4wteyz1bTEADcE5/QY/XaguMYt2zEPhoaDhAapOQ+VhwAWxgCqGx IVn9Gn/72ys8PKnSCSLQ5KgYhwJiZZiyWU+q5LPc4CwaqhFI43sFXbBeXal9ZrXKUF2E OplQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uXIPSGmdJG21ikb/sK3lpgdrOg0gpNf68qdUnYJvn60=; b=mXrPz1tlaVjts9B8XBhYRGQRnaxLdLYNyspTAX41qNiBGETnyaciYCrIqJbLsJtH+I m8Ry+Tv3H519kbIeVfXJESxWAvOkj6YMYML1mqMQdhQl8ohcyjsJJPIEdgvmnlYE+BeS p5aM/a/kefJOOU5r9bOzVbrp6JvCzmJtyT91cQYJs6ZFMCCFjBZJxJIPxDYPJy5wR2u0 73X8YAtbSY6EetgUiCSM/GJ+DyjKCy30R3Gxt+kzjPDdWVVznICa7WGgyh7WYvy+P4wt HVZ5Mcnbf/pKdMPM+A8jypG0HlZskJSHxqZwctexqsv+yItO72W88agQWx3z0brdwECS eT4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=LbKDrk3A; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si39588oir.76.2020.03.16.06.56.35; Mon, 16 Mar 2020 06:56:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=LbKDrk3A; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731488AbgCPNzk (ORCPT + 99 others); Mon, 16 Mar 2020 09:55:40 -0400 Received: from mail-bn8nam11on2083.outbound.protection.outlook.com ([40.107.236.83]:19325 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731110AbgCPNzg (ORCPT ); Mon, 16 Mar 2020 09:55:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H7lcAS40MJb9XD0iIlZI9xLsvNVtFudKMbpgkPVZOr7b5i4OUSu8Z+EPwjFUgJlX8DSA2dAev27TUIs7ryj0JLPNQk9RTADTRguRZr7/XK/GD97nofNk4xkqWy7oRM1B3nPhoJUP8zg3IijZDCXSqyHP1TDJZ48yGcW+VI/Gi1BLpzZ7cNH0jnc/XtfHyKmJCqnUmoHPNaI7JyD+f1ufTpFBw6FJ/wX5/BRczgBOioO7CsMfI4W9bugztDScux8a87rtMhqFd/1DJPHMMBMGlYLYDoXqJinZICmO8rPoGybej1WolyooXECzvvuoQ9miGnYKISM5WtDA04oZyNR5dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uXIPSGmdJG21ikb/sK3lpgdrOg0gpNf68qdUnYJvn60=; b=PfUviCSaFtEWGxE/ITpl5VHtPgLjsgUq0hQL3JylQUi0qfXtnHmnL/it3VRKPEX8cPK5dQLLXU7Lhj9mzJnFg143fXQDtd7hMP+DA6eeADRqbffloSVgUV30jUdv7o7FYdFr+3wxnT0zXUOVpr0jcDDbTwBEmqWT2bB+WDoL9QSw7LLU37zmi6pQb+/cCXBYgTFmpBmqoz+fXyVHSDwi2N5yDtlAvxzJUojigo2dHntxpF92NUJNolZqmNBUS//9KooLXxjFdv/St+l7AzeX8BS8D8b4bN2q6qjqJSb8D7Y3w1IIRQWAKGx4vU5eyxX6qkyeJOF3S0WhyGnGP66DbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uXIPSGmdJG21ikb/sK3lpgdrOg0gpNf68qdUnYJvn60=; b=LbKDrk3AgQx43YJvGDyFGBZ53zCA/ym3QPVuKKrPRZrly0GEp8aeXXvUsNqQmGXyMqb5s41uiCRuRnAvBRB0dEH12+V+/wJBUr+FmTfLGN3K8oEwzZfVc6Xsr5D4n06BH6T+mwu+zCLzoTAww8cD7UPBESH9MEXvF8h0SUfSR7g= Received: from DM5PR11CA0005.namprd11.prod.outlook.com (2603:10b6:3:115::15) by BL0PR02MB4691.namprd02.prod.outlook.com (2603:10b6:208:59::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.18; Mon, 16 Mar 2020 13:55:32 +0000 Received: from CY1NAM02FT008.eop-nam02.prod.protection.outlook.com (2603:10b6:3:115:cafe::8c) by DM5PR11CA0005.outlook.office365.com (2603:10b6:3:115::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.18 via Frontend Transport; Mon, 16 Mar 2020 13:55:32 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT008.mail.protection.outlook.com (10.152.75.59) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2814.13 via Frontend Transport; Mon, 16 Mar 2020 13:55:31 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1jDqDL-00041P-4n; Mon, 16 Mar 2020 06:55:31 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jDqDG-0003xV-1W; Mon, 16 Mar 2020 06:55:26 -0700 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 02GDtFHv027781; Mon, 16 Mar 2020 06:55:16 -0700 Received: from [10.140.6.23] (helo=xhdmubinusm40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jDqD5-0003l2-GY; Mon, 16 Mar 2020 06:55:15 -0700 From: Mubin Usman Sayyed To: tglx@linutronix.de, jason@lakedaemon.net, maz@kernel.org, michals@xilinx.com, linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, sivadur@xilinx.com, anirudh@xilinx.com, Mubin Sayyed , Anirudha Sarangi Subject: [PATCH v4 1/3] irqchip: xilinx: Add support for multiple instances Date: Mon, 16 Mar 2020 19:24:45 +0530 Message-Id: <20200316135447.30162-2-mubin.usman.sayyed@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200316135447.30162-1-mubin.usman.sayyed@xilinx.com> References: <20200316135447.30162-1-mubin.usman.sayyed@xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(396003)(376002)(346002)(136003)(39850400004)(199004)(46966005)(103116003)(54906003)(478600001)(2906002)(81166006)(9786002)(26005)(8676002)(5660300002)(8936002)(81156014)(336012)(426003)(316002)(186003)(7696005)(107886003)(4326008)(356004)(2616005)(70586007)(36756003)(47076004)(6666004)(1076003)(70206006);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR02MB4691;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1; Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97f0e5b8-4a9f-4aa6-0aa0-08d7c9b1b155 X-MS-TrafficTypeDiagnostic: BL0PR02MB4691: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:854; X-Forefront-PRVS: 03449D5DD1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7ook9cREjHgUHXJIXNMD2E5Nlw3157smkOHPCcHLIubKLKvvXw48vgYJu5ZpGbeF8Tpef6cNJaHrRMwnhSs1vmeDu2Z3ZVNLzTQM9ppbOs8MaE4MLmuDcEeOMtQQJhQYz/GyozXye5uR9xUfOsFRZ8+akxUBE5/9diFJYjXYo+D0I29NcD85mpeUO/yyc8U/93zwgVMMXdT3aoV62ZACx+BPGv3mojqenDYJu7Sv1YExw5C3/rwjF7Guf4+qIlVY0G3O5E4t7hdprcU++9Enkw5bLFeSUR5LklIBY8m8MOmlTDtDxyLTsvJ/X+bdP1UDm4mZ/gRdUcz3rWl62A8HAd5oYDswKtFK2xesND5eoS/iBC3TOLvzQLaSjC+jxLC+HJBamdURtccYxES75+mAoDcWXl7i/NAw8twbgMaQp150ctCFKZOC6XqWevTpV80P74rodB1PEVyqGjVYbU0IgBqqR2s+OHIsXvVdtzlYtbS+EvWXFAaPNmNv1mh0Sz+lA3C1h5e5RaHWDGSVOqbcIQ== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2020 13:55:31.5617 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97f0e5b8-4a9f-4aa6-0aa0-08d7c9b1b155 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4691 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mubin Sayyed Added support for cascaded interrupt controllers. Following cascaded configurations have been tested, - peripheral->xilinx-intc->xilinx-intc->gic->Cortexa53 processor on zcu102 board - peripheral->xilinx-intc->xilinx-intc->microblaze processor on kcu105 board Signed-off-by: Mubin Sayyed Signed-off-by: Anirudha Sarangi --- Changes for v4: - Fixed review comments from Thomas - updated commit message, variable declarations changed to reverse fir tree and cleaned up some code. Changes for v3: - Modified prototype of xintc_write/xintc_read - Fixed review comments regarding indentation/variable names, used BIT - Modified xintc_get_irq_local to return 0 in case of failure/no pending interrupts - Fixed return type of xintc_read - Reverted changes related to device name and kept intc_dev as static Changes for v2: - Removed write_fn/read_fn hooks, used xintc_write/ xintc_read directly - Moved primary_intc declaration after xintc_irq_chip --- drivers/irqchip/irq-xilinx-intc.c | 121 ++++++++++++++++++------------ 1 file changed, 71 insertions(+), 50 deletions(-) diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c index e3043ded8973..65b77720ef2e 100644 --- a/drivers/irqchip/irq-xilinx-intc.c +++ b/drivers/irqchip/irq-xilinx-intc.c @@ -38,29 +38,32 @@ struct xintc_irq_chip { void __iomem *base; struct irq_domain *root_domain; u32 intr_mask; + struct irq_chip *intc_dev; + u32 nr_irq; }; -static struct xintc_irq_chip *xintc_irqc; +static struct xintc_irq_chip *primary_intc; -static void xintc_write(int reg, u32 data) +static void xintc_write(struct xintc_irq_chip *irqc, int reg, u32 data) { if (static_branch_unlikely(&xintc_is_be)) - iowrite32be(data, xintc_irqc->base + reg); + iowrite32be(data, irqc->base + reg); else - iowrite32(data, xintc_irqc->base + reg); + iowrite32(data, irqc->base + reg); } -static unsigned int xintc_read(int reg) +static u32 xintc_read(struct xintc_irq_chip *irqc, int reg) { if (static_branch_unlikely(&xintc_is_be)) - return ioread32be(xintc_irqc->base + reg); + return ioread32be(irqc->base + reg); else - return ioread32(xintc_irqc->base + reg); + return ioread32(irqc->base + reg); } static void intc_enable_or_unmask(struct irq_data *d) { - unsigned long mask = 1 << d->hwirq; + struct xintc_irq_chip *irqc = irq_data_get_irq_chip_data(d); + unsigned long mask = BIT(d->hwirq); pr_debug("irq-xilinx: enable_or_unmask: %ld\n", d->hwirq); @@ -69,30 +72,35 @@ static void intc_enable_or_unmask(struct irq_data *d) * acks the irq before calling the interrupt handler */ if (irqd_is_level_type(d)) - xintc_write(IAR, mask); + xintc_write(irqc, IAR, mask); - xintc_write(SIE, mask); + xintc_write(irqc, SIE, mask); } static void intc_disable_or_mask(struct irq_data *d) { + struct xintc_irq_chip *irqc = irq_data_get_irq_chip_data(d); + pr_debug("irq-xilinx: disable: %ld\n", d->hwirq); - xintc_write(CIE, 1 << d->hwirq); + xintc_write(irqc, CIE, BIT(d->hwirq)); } static void intc_ack(struct irq_data *d) { + struct xintc_irq_chip *irqc = irq_data_get_irq_chip_data(d); + pr_debug("irq-xilinx: ack: %ld\n", d->hwirq); - xintc_write(IAR, 1 << d->hwirq); + xintc_write(irqc, IAR, BIT(d->hwirq)); } static void intc_mask_ack(struct irq_data *d) { - unsigned long mask = 1 << d->hwirq; + struct xintc_irq_chip *irqc = irq_data_get_irq_chip_data(d); + unsigned long mask = BIT(d->hwirq); pr_debug("irq-xilinx: disable_and_ack: %ld\n", d->hwirq); - xintc_write(CIE, mask); - xintc_write(IAR, mask); + xintc_write(irqc, CIE, mask); + xintc_write(irqc, IAR, mask); } static struct irq_chip intc_dev = { @@ -103,13 +111,28 @@ static struct irq_chip intc_dev = { .irq_mask_ack = intc_mask_ack, }; +static unsigned int xintc_get_irq_local(struct xintc_irq_chip *irqc) +{ + unsigned int irq = 0; + u32 hwirq; + + hwirq = xintc_read(irqc, IVR); + if (hwirq != -1U) + irq = irq_find_mapping(irqc->root_domain, hwirq); + + pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq); + + return irq; +} + unsigned int xintc_get_irq(void) { - unsigned int hwirq, irq = -1; + unsigned int irq = -1; + u32 hwirq; - hwirq = xintc_read(IVR); + hwirq = xintc_read(primary_intc, IVR); if (hwirq != -1U) - irq = irq_find_mapping(xintc_irqc->root_domain, hwirq); + irq = irq_find_mapping(primary_intc->root_domain, hwirq); pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq); @@ -118,15 +141,18 @@ unsigned int xintc_get_irq(void) static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { - if (xintc_irqc->intr_mask & (1 << hw)) { - irq_set_chip_and_handler_name(irq, &intc_dev, - handle_edge_irq, "edge"); + struct xintc_irq_chip *irqc = d->host_data; + + if (irqc->intr_mask & BIT(hw)) { + irq_set_chip_and_handler_name(irq, irqc->intc_dev, + handle_edge_irq, "edge"); irq_clear_status_flags(irq, IRQ_LEVEL); } else { - irq_set_chip_and_handler_name(irq, &intc_dev, - handle_level_irq, "level"); + irq_set_chip_and_handler_name(irq, irqc->intc_dev, + handle_level_irq, "level"); irq_set_status_flags(irq, IRQ_LEVEL); } + irq_set_chip_data(irq, irqc); return 0; } @@ -138,12 +164,14 @@ static const struct irq_domain_ops xintc_irq_domain_ops = { static void xil_intc_irq_handler(struct irq_desc *desc) { struct irq_chip *chip = irq_desc_get_chip(desc); + struct xintc_irq_chip *irqc; u32 pending; + irqc = irq_data_get_irq_handler_data(&desc->irq_data); chained_irq_enter(chip, desc); do { - pending = xintc_get_irq(); - if (pending == -1U) + pending = xintc_get_irq_local(irqc); + if (pending == 0U) break; generic_handle_irq(pending); } while (true); @@ -153,28 +181,19 @@ static void xil_intc_irq_handler(struct irq_desc *desc) static int __init xilinx_intc_of_init(struct device_node *intc, struct device_node *parent) { - u32 nr_irq; - int ret, irq; struct xintc_irq_chip *irqc; - - if (xintc_irqc) { - pr_err("irq-xilinx: Multiple instances aren't supported\n"); - return -EINVAL; - } + int ret, irq; irqc = kzalloc(sizeof(*irqc), GFP_KERNEL); if (!irqc) return -ENOMEM; - - xintc_irqc = irqc; - irqc->base = of_iomap(intc, 0); BUG_ON(!irqc->base); - ret = of_property_read_u32(intc, "xlnx,num-intr-inputs", &nr_irq); + ret = of_property_read_u32(intc, "xlnx,num-intr-inputs", &irqc->nr_irq); if (ret < 0) { pr_err("irq-xilinx: unable to read xlnx,num-intr-inputs\n"); - goto err_alloc; + goto error; } ret = of_property_read_u32(intc, "xlnx,kind-of-intr", &irqc->intr_mask); @@ -183,34 +202,35 @@ static int __init xilinx_intc_of_init(struct device_node *intc, irqc->intr_mask = 0; } - if (irqc->intr_mask >> nr_irq) + if (irqc->intr_mask >> irqc->nr_irq) pr_warn("irq-xilinx: mismatch in kind-of-intr param\n"); pr_info("irq-xilinx: %pOF: num_irq=%d, edge=0x%x\n", - intc, nr_irq, irqc->intr_mask); + intc, irqc->nr_irq, irqc->intr_mask); + irqc->intc_dev = &intc_dev; /* * Disable all external interrupts until they are * explicity requested. */ - xintc_write(IER, 0); + xintc_write(irqc, IER, 0); /* Acknowledge any pending interrupts just in case. */ - xintc_write(IAR, 0xffffffff); + xintc_write(irqc, IAR, 0xffffffff); /* Turn on the Master Enable. */ - xintc_write(MER, MER_HIE | MER_ME); - if (!(xintc_read(MER) & (MER_HIE | MER_ME))) { + xintc_write(irqc, MER, MER_HIE | MER_ME); + if (xintc_read(irqc, MER) != (MER_HIE | MER_ME)) { static_branch_enable(&xintc_is_be); - xintc_write(MER, MER_HIE | MER_ME); + xintc_write(irqc, MER, MER_HIE | MER_ME); } - irqc->root_domain = irq_domain_add_linear(intc, nr_irq, + irqc->root_domain = irq_domain_add_linear(intc, irqc->nr_irq, &xintc_irq_domain_ops, irqc); if (!irqc->root_domain) { pr_err("irq-xilinx: Unable to create IRQ domain\n"); - goto err_alloc; + goto error; } if (parent) { @@ -222,16 +242,17 @@ static int __init xilinx_intc_of_init(struct device_node *intc, } else { pr_err("irq-xilinx: interrupts property not in DT\n"); ret = -EINVAL; - goto err_alloc; + goto error; } } else { - irq_set_default_host(irqc->root_domain); + primary_intc = irqc; + irq_set_default_host(primary_intc->root_domain); } return 0; -err_alloc: - xintc_irqc = NULL; +error: + iounmap(irqc->base); kfree(irqc); return ret; -- 2.25.0