Skip to contentSkip to conversation

powerpc/ps3: Simplify control flow in ps3_{virq,irq_plug}_setup()

PATCH Applied Thorsten Blum 4 participants 4 messages Sep 14 – Sep 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/ps3: Simplify control flow in ps3_{virq,irq_plug}_setup()

In ps3_virq_setup() and ps3_irq_plug_setup(), remove the goto statements and handle errors directly.

---
 arch/powerpc/platforms/ps3/interrupt.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
arch/powerpc/platforms/ps3/interrupt.c +6 -16
index a4ad4b49eef7..358611638258 100644
@@ -184,8 +184,7 @@ static int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
 	if (!*virq) {
 		FAIL("%s:%d: irq_create_mapping failed: outlet %lu\n",
 			__func__, __LINE__, outlet);
-		result = -ENOMEM;
-		goto fail_create;
+		return -ENOMEM;
 	}
 
 	DBG("%s:%d: outlet %lu => cpu %u, virq %u\n", __func__, __LINE__,
@@ -196,17 +195,13 @@ static int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
 	if (result) {
 		FAIL("%s:%d: irq_set_chip_data failed\n",
 			__func__, __LINE__);
-		goto fail_set;
+		irq_dispose_mapping(*virq);
+		return result;
 	}
 
 	ps3_chip_mask(irq_get_irq_data(*virq));
 
 	return result;
-
-fail_set:
-	irq_dispose_mapping(*virq);
-fail_create:
-	return result;
 }
 
 /**
@@ -250,7 +245,7 @@ int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
 
 	if (result) {
 		FAIL("%s:%d: ps3_virq_setup failed\n", __func__, __LINE__);
-		goto fail_setup;
+		return result;
 	}
 
 	pd = irq_get_chip_data(*virq);
@@ -263,16 +258,11 @@ int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
 	if (result) {
 		FAIL("%s:%d: lv1_connect_irq_plug_ext failed: %s\n",
 		__func__, __LINE__, ps3_result(result));
-		result = -EPERM;
-		goto fail_connect;
+		ps3_virq_destroy(*virq);
+		return -EPERM;
 	}
 
 	return result;
-
-fail_connect:
-	ps3_virq_destroy(*virq);
-fail_setup:
-	return result;
 }
 EXPORT_SYMBOL_GPL(ps3_irq_plug_setup);
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Thorsten Blum

In ps3_virq_setup() and ps3_irq_plug_setup(), remove the goto statements and handle errors directly.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds