From patchwork Thu Jul 11 16:09:07 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: 13730847 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 E5FC0C3DA49 for ; Thu, 11 Jul 2024 16:12:21 +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=bFeNY905BSFjiCOL6cj+sxh/6fLlgKG18n6BnTNCFNI=; b=dgCIzVpWtW6SnQBvvRGprg4X2G V5RsbUxM2JjqBftfo6ZlU8F8L61ERl7sKCo5XoV/HHOqJOjbbo4kBsc00oqFs0E5k5/5vknljWKYX QEE5ZukZQ4RxRlEOebx6eVnQi4Oi1vpH+NEBGCEU6qCte1A7S5epLRBGWR80eU5X5Wg1fGhBuZfcV IZzYIpK9BaOXE/gsF/iceBd2kNXa4Ok+UihD+5Vp5qVJulGFwNh5sQGtDSS1ZF3paEsIlmzc+4D4G 32osO5bQYF07bRA+xF6SGpGORCukq8oxXsGcmkmlhTB0j5tYaOUM0UGuXm0DwBejuE13EAMy8MQ/q CgCuKuNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRwOv-0000000EdqV-1uVw; Thu, 11 Jul 2024 16:12:09 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRwMX-0000000Ecnf-0J13 for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2024 16:09:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 74004CE191E; Thu, 11 Jul 2024 16:09:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735F0C4AF09; Thu, 11 Jul 2024 16:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720714178; bh=9Tx07jhlw6n2lniOC+Pet+fG35liDdMYp1X5CKPy9cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ln1NDCuz5DCR2KoVesAyIIQ43d0Sn/ttl0N0yrbG/1Nl95nO/r4IhkJr7lgYeFvMQ YLu/eMG5Ay0XYyMs+FLz2nkmfuQGokyCJ3ZSBqQlC16w3i5iNUCXqVu7a36mdJnGk4 XeQS3GK2/FF0SG3FN+gyAV1IzIkN9v//VWWjjf1KCdgPhk8Cex3L1PxBHWR/KStrIX q5SRjgSIATgPsrAvTI2XfwqITo6wJHKTca6SqTCTMwLjSCW74z26Wh6k/fvlmukecI ukzxa22sNvvzADTQY35j8LCa69T2j/a52abN4kuH4LmjGggc2kpmlb4+s/kn1mf9DK rGGHLnrPJrz+g== 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 10/10] irqchip/armada-370-xp: Print error and return error code on initialization failure Date: Thu, 11 Jul 2024 18:09:07 +0200 Message-ID: <20240711160907.31012-11-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240711160907.31012-1-kabel@kernel.org> References: <20240711160907.31012-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240711_090941_537371_84620183 X-CRM114-Status: GOOD ( 12.46 ) 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 dccc69aa2bf4..c93fab8ac2e4 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);