From 1eb5498df2af9ab1175f9a397c566c587f310878 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 16 Jun 2015 23:44:28 +0000 Subject: [PATCH] scst_local: Correct error handling in scst_local_sysfs_mgmt_cmd() Avoid that __scst_local_add_adapter() failures are ignored. Detected by Coverity. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6342 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst_local/scst_local.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 92a971326..abae3052f 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -733,7 +733,7 @@ out_up: static ssize_t scst_local_sysfs_mgmt_cmd(char *buf) { - ssize_t res; + ssize_t res = 0; char *command, *target_name, *session_name; struct scst_local_tgt *t, *tgt; @@ -793,8 +793,6 @@ static ssize_t scst_local_sysfs_mgmt_cmd(char *buf) scst_local_close_session_impl(sess, false); } - res = 0; - out_unlock: mutex_unlock(&scst_local_mutex);