[PATCH 2/3] irqchip/gic-v3: Propagate gic_cpu_pm_init() return code

From: Florian Fainelli
Date: Tue Feb 14 2023 - 18:34:44 EST


In preparation for allocating memory which may fail, propagate the
return code from gic_cpu_pm_init().

Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
---
drivers/irqchip/irq-gic-v3.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index b60fadb7eb44..48b0e9aba27c 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1395,9 +1395,11 @@ static struct notifier_block gic_cpu_pm_notifier_block = {
.notifier_call = gic_cpu_pm_notifier,
};

-static void gic_cpu_pm_init(void)
+static int gic_cpu_pm_init(void)
{
cpu_pm_register_notifier(&gic_cpu_pm_notifier_block);
+
+ return 0;
}

#else
@@ -1891,7 +1893,9 @@ static int __init gic_init_bases(void __iomem *dist_base,
gic_dist_init();
gic_cpu_init();
gic_smp_init();
- gic_cpu_pm_init();
+ err = gic_cpu_pm_init();
+ if (err)
+ goto out_set_handle;

if (gic_dist_supports_lpis()) {
its_init(handle, &gic_data.rdists, gic_data.domain);
@@ -1906,6 +1910,8 @@ static int __init gic_init_bases(void __iomem *dist_base,

return 0;

+out_set_handle:
+ set_handle_irq(NULL);
out_free:
if (gic_data.domain)
irq_domain_remove(gic_data.domain);
--
2.34.1