From d2d0c488aaaa52300f0401ae461c54552f17549e Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 29 Sep 2012 22:33:20 +0000 Subject: [PATCH] scst_local_add_target(): Also set *out_tgt upon failure Although the callers of scst_local_add_target() do not use the value of *out_tgt if scst_local_add_target() reports that it failed, set *out_tgt in that case to avoid that sparse reports the following (false positive) warning: scst_local/scst_local.c:1807: warning: 'tgt' may be used uninitialized in this function Signed-off-by: Bart Van Assche git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4534 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst_local/scst_local.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 9039424c9..d84e1e636 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1743,12 +1743,12 @@ static int scst_local_add_target(const char *target_name, list_add_tail(&tgt->tgts_list_entry, &scst_local_tgts_list); mutex_unlock(&scst_local_mutex); - if (out_tgt != NULL) - *out_tgt = tgt; - res = 0; out: + if (out_tgt != NULL) + *out_tgt = tgt; + TRACE_EXIT_RES(res); return res;