From d553113656c1668f836ca5da9447b4fe4fb9048e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 29 Apr 2015 15:52:21 +0200 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. Signed-off-by: Bart Van Assche --- 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);