Commit 82a819e8 authored by Luis de Bethencourt's avatar Luis de Bethencourt Committed by Nicholas Bellinger

iscsi-target: return -ENOMEM instead of -1 in case of failed kmalloc()

Smatch complains about returning hard coded error codes, silence this
warning.

drivers/target/iscsi/iscsi_target_parameters.c:211
   iscsi_create_default_params() warn: returning -1 instead of -ENOMEM is sloppy
Signed-off-by: default avatarLuis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 6ba4bd29
...@@ -208,7 +208,7 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) ...@@ -208,7 +208,7 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr)
if (!pl) { if (!pl) {
pr_err("Unable to allocate memory for" pr_err("Unable to allocate memory for"
" struct iscsi_param_list.\n"); " struct iscsi_param_list.\n");
return -1 ; return -ENOMEM;
} }
INIT_LIST_HEAD(&pl->param_list); INIT_LIST_HEAD(&pl->param_list);
INIT_LIST_HEAD(&pl->extra_response_list); INIT_LIST_HEAD(&pl->extra_response_list);
...@@ -578,7 +578,7 @@ int iscsi_copy_param_list( ...@@ -578,7 +578,7 @@ int iscsi_copy_param_list(
param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL);
if (!param_list) { if (!param_list) {
pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); pr_err("Unable to allocate memory for struct iscsi_param_list.\n");
return -1; return -ENOMEM;
} }
INIT_LIST_HEAD(&param_list->param_list); INIT_LIST_HEAD(&param_list->param_list);
INIT_LIST_HEAD(&param_list->extra_response_list); INIT_LIST_HEAD(&param_list->extra_response_list);
...@@ -629,7 +629,7 @@ int iscsi_copy_param_list( ...@@ -629,7 +629,7 @@ int iscsi_copy_param_list(
err_out: err_out:
iscsi_release_param_list(param_list); iscsi_release_param_list(param_list);
return -1; return -ENOMEM;
} }
static void iscsi_release_extra_responses(struct iscsi_param_list *param_list) static void iscsi_release_extra_responses(struct iscsi_param_list *param_list)
...@@ -729,7 +729,7 @@ static int iscsi_add_notunderstood_response( ...@@ -729,7 +729,7 @@ static int iscsi_add_notunderstood_response(
if (!extra_response) { if (!extra_response) {
pr_err("Unable to allocate memory for" pr_err("Unable to allocate memory for"
" struct iscsi_extra_response.\n"); " struct iscsi_extra_response.\n");
return -1; return -ENOMEM;
} }
INIT_LIST_HEAD(&extra_response->er_list); INIT_LIST_HEAD(&extra_response->er_list);
...@@ -1370,7 +1370,7 @@ int iscsi_decode_text_input( ...@@ -1370,7 +1370,7 @@ int iscsi_decode_text_input(
tmpbuf = kzalloc(length + 1, GFP_KERNEL); tmpbuf = kzalloc(length + 1, GFP_KERNEL);
if (!tmpbuf) { if (!tmpbuf) {
pr_err("Unable to allocate %u + 1 bytes for tmpbuf.\n", length); pr_err("Unable to allocate %u + 1 bytes for tmpbuf.\n", length);
return -1; return -ENOMEM;
} }
memcpy(tmpbuf, textbuf, length); memcpy(tmpbuf, textbuf, length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment