irqchip: mmp: Use common error handling code in mmp2_mux_of_init()
Subsystems (2)
PATCH 1/1 irqchip: mmp: Use common error handling code in mmp2_mux_of_init()
From: Markus Elfring <[email protected]>
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 <[email protected]>
--- drivers/irqchip/irq-mmp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/irqchip/irq-mmp.c +10 -8
@@ -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
Signature · 1 line
2.14.3