From patchwork Tue Jul 2 11:43:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13719508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89E9EC3064D for ; Tue, 2 Jul 2024 11:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=m1HeVQRtkV7HE6xM1VSKfYALB8YShGBCkx2RzAh/D8E=; b=4L8yqmRVxU1ZDManG9riKwJeoD jCNVJCLhSYQD/cE8FAEMuhXSqa5I9yezyzzjOQTn5OMI4ec2z015XzYCS8XDdJAlF9wdfgjv8k28x kYITz1P4G6wXsrdqU8AnuHerCxKOW7qUhnkFjqpR3RurWj46rFjjYJciJTykV7IFotJm+BdD0aTiF /m2TiwhPf/5m6rdgJ4pJSiAG8ILCImmkEpWsWbN5PLMQtfu/YZERv/7LvvUNr1MymAgA/XdtC757C JdV3KnHGM9FC7HFojPdUSnTUQ9CL/gLJ2Bu7SMbSSUvwtYBnpLUBd/za6/BxDQSZLqxr7s3rhmT/H MIYBMtjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sObza-00000006YYG-1S2P; Tue, 02 Jul 2024 11:48:14 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sObvv-00000006Wg8-0kfb for linux-arm-kernel@lists.infradead.org; Tue, 02 Jul 2024 11:44:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 73E9361CD1; Tue, 2 Jul 2024 11:44:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 078CFC116B1; Tue, 2 Jul 2024 11:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719920666; bh=l0wr8++C93tj8Qreovn1fQgGodkz3NVrI6Z18u58Jpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UoplqCapqKgkc5Y3kCvC3/A8JHy7PwS5iy0XU/T9eQQ0e1tTZgyktUYAuQEUZPjyi 1QtK1zUN4H+K0h18mwfM1gSqCk+WzkqqNW5uCA/RSiTGKN39bXVrFOig8R8QvhxllF bYUTj68XdQLvWu9F5P1C21JxOlo7Qw99lNW9gEPbe1yiNZd5WnGFP2AigTB3UmpUrC g9tP3vbKuanIiTWUfN+T6uDiC0oEvmjzL590C58aQdvcOZGSeCFD4Ort/FrgK3CdwV gqhnTQy9D6lGkIGW0iqnmCDKUgpAMZPWsLCtzkZ3aC+ooKQMyMvKOJijoNGL86QliV UDTXkW799At7g== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH v2 30/30] irqchip/armada-370-xp: Print error and return error code on initialization failure Date: Tue, 2 Jul 2024 13:43:02 +0200 Message-ID: <20240702114302.22475-31-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240702114302.22475-1-kabel@kernel.org> References: <20240702114302.22475-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_044427_378610_62661191 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Print error and return error code on main / IPI / MSI domain initialization failure. Use WARN_ON() instead of BUG_ON(). Signed-off-by: Marek BehĂșn --- drivers/irqchip/irq-armada-370-xp.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index d9154f75d7f3..5890843b491e 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -473,7 +473,7 @@ static void mpic_ipi_resume(void) } } -static __init void mpic_ipi_init(struct device_node *node) +static __init int mpic_ipi_init(struct device_node *node) { int base_ipi; @@ -481,15 +481,17 @@ static __init void mpic_ipi_init(struct device_node *node) IPI_DOORBELL_END, &mpic_ipi_domain_ops, NULL); if (WARN_ON(!mpic_ipi_domain)) - return; + return -ENOMEM; irq_domain_update_bus_token(mpic_ipi_domain, DOMAIN_BUS_IPI); base_ipi = irq_domain_alloc_irqs(mpic_ipi_domain, IPI_DOORBELL_END, NUMA_NO_NODE, NULL); if (WARN_ON(!base_ipi)) - return; + return -ENOMEM; set_smp_ipi_range(base_ipi, IPI_DOORBELL_END); + + return 0; } static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, @@ -823,7 +825,11 @@ static int __init mpic_of_init(struct device_node *node, writel(i, main_int_base + MPIC_INT_CLEAR_ENABLE); mpic_domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, NULL); - BUG_ON(!mpic_domain); + if (!mpic_domain) { + pr_err("%pOF: Unable to add IRQ domain\n", node); + return -ENOMEM; + } + irq_domain_update_bus_token(mpic_domain, DOMAIN_BUS_WIRED); /* @@ -836,13 +842,22 @@ static int __init mpic_of_init(struct device_node *node, mpic_perf_init(); mpic_smp_cpu_init(); - mpic_msi_init(node, phys_base); + err = mpic_msi_init(node, phys_base); + if (err) { + pr_err("%pOF: Unable to initialize MSI domain\n", node); + return err; + } if (parent_irq <= 0) { irq_set_default_host(mpic_domain); set_handle_irq(mpic_handle_irq); #ifdef CONFIG_SMP - mpic_ipi_init(node); + err = mpic_ipi_init(node); + if (err) { + pr_err("%pOF: Unable to initialize IPI domain\n", node); + return err; + } + cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING, "irqchip/armada/ipi:starting", mpic_starting_cpu, NULL);