From 3d1468cfaceda8eaf46905ae5cec5f66bebcc8dc Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 13 Sep 2012 08:15:23 +0000 Subject: [PATCH] ib_srpt: Convert two functions two single-exit style git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4516 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 105c59ad5..b318f9aef 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2380,11 +2380,12 @@ static struct srpt_tgt *srpt_convert_scst_tgt(struct scst_tgt *scst_tgt) static int srpt_enable_target(struct scst_tgt *scst_tgt, bool enable) { struct srpt_tgt *srpt_tgt = srpt_convert_scst_tgt(scst_tgt); + int res = -E_TGT_PRIV_NOT_YET_SET; EXTRACHECKS_WARN_ON_ONCE(irqs_disabled()); if (!srpt_tgt) - return -E_TGT_PRIV_NOT_YET_SET; + goto out; TRACE_DBG("%s target %s", enable ? "Enabling" : "Disabling", scst_tgt->tgt_name); @@ -2395,7 +2396,10 @@ static int srpt_enable_target(struct scst_tgt *scst_tgt, bool enable) __srpt_close_all_ch(srpt_tgt); spin_unlock_irq(&srpt_tgt->spinlock); - return 0; + res = 0; + +out: + return res; } /** @@ -2405,10 +2409,7 @@ static bool srpt_is_target_enabled(struct scst_tgt *scst_tgt) { struct srpt_tgt *srpt_tgt = srpt_convert_scst_tgt(scst_tgt); - if (srpt_tgt) - return srpt_tgt->enabled; - else - return false; + return srpt_tgt && srpt_tgt->enabled; } #endif