mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] irqchip: mmp: Use common error handling code in mmp2_mux_of_init()
@ 2017-10-26 20:14 SF Markus Elfring
  0 siblings, 0 replies; only message in thread
From: SF Markus Elfring @ 2017-10-26 20:14 UTC (permalink / raw)
  To: kernel-janitors, Daniel Drake, Haojian Zhuang, Jason Cooper,
	Marc Zyngier, Thomas Gleixner
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 26 Oct 2017 22:05:26 +0200

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/irqchip/irq-mmp.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c
index 25f32e1d7764..4a3dd020777f 100644
--- a/drivers/irqchip/irq-mmp.c
+++ b/drivers/irqchip/irq-mmp.c
@@ -438,16 +438,14 @@ static int __init mmp2_mux_of_init(struct device_node *node,
 		return -EINVAL;
 	}
 	ret = of_address_to_resource(node, 0, &res);
-	if (ret < 0) {
-		pr_err("Not found reg property\n");
-		return -EINVAL;
-	}
+	if (ret < 0)
+		goto report_failure;
+
 	icu_data[i].reg_status = mmp_icu_base + res.start;
 	ret = of_address_to_resource(node, 1, &res);
-	if (ret < 0) {
-		pr_err("Not found reg property\n");
-		return -EINVAL;
-	}
+	if (ret < 0)
+		goto report_failure;
+
 	icu_data[i].reg_mask = mmp_icu_base + res.start;
 	icu_data[i].cascade_irq = irq_of_parse_and_map(node, 0);
 	if (!icu_data[i].cascade_irq)
@@ -483,6 +481,10 @@ static int __init mmp2_mux_of_init(struct device_node *node,
 	}
 	irq_domain_remove(icu_data[i].domain);
 	return -EINVAL;
+
+report_failure:
+	pr_err("Not found reg property\n");
+	return -EINVAL;
 }
 IRQCHIP_DECLARE(mmp2_mux_intc, "mrvl,mmp2-mux-intc", mmp2_mux_of_init);
 #endif
-- 
2.14.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-26 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-26 20:14 [PATCH] irqchip: mmp: Use common error handling code in mmp2_mux_of_init() SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome