mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Daniel Drake <dsd@laptop.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] irqchip: mmp: Use common error handling code in mmp2_mux_of_init()
Date: Thu, 26 Oct 2017 22:14:19 +0200	[thread overview]
Message-ID: <690b6f85-80a7-4add-2106-a3df2c614cd5@users.sourceforge.net> (raw)

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

                 reply	other threads:[~2017-10-26 20:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=690b6f85-80a7-4add-2106-a3df2c614cd5@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=dsd@laptop.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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