Commit c46e22f1 authored by Markus Elfring's avatar Markus Elfring Committed by Nicholas Bellinger

iscsi-target: Delete error messages for failed memory allocations

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdfSigned-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent f1725110
...@@ -129,10 +129,8 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf) ...@@ -129,10 +129,8 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf)
} }
tiqn = kzalloc(sizeof(struct iscsi_tiqn), GFP_KERNEL); tiqn = kzalloc(sizeof(struct iscsi_tiqn), GFP_KERNEL);
if (!tiqn) { if (!tiqn)
pr_err("Unable to allocate struct iscsi_tiqn\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
sprintf(tiqn->tiqn, "%s", buf); sprintf(tiqn->tiqn, "%s", buf);
INIT_LIST_HEAD(&tiqn->tiqn_list); INIT_LIST_HEAD(&tiqn->tiqn_list);
...@@ -364,7 +362,6 @@ struct iscsi_np *iscsit_add_np( ...@@ -364,7 +362,6 @@ struct iscsi_np *iscsit_add_np(
np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL); np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL);
if (!np) { if (!np) {
pr_err("Unable to allocate memory for struct iscsi_np\n");
mutex_unlock(&np_lock); mutex_unlock(&np_lock);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -698,10 +695,9 @@ static int __init iscsi_target_init_module(void) ...@@ -698,10 +695,9 @@ static int __init iscsi_target_init_module(void)
pr_debug("iSCSI-Target "ISCSIT_VERSION"\n"); pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
iscsit_global = kzalloc(sizeof(struct iscsit_global), GFP_KERNEL); iscsit_global = kzalloc(sizeof(struct iscsit_global), GFP_KERNEL);
if (!iscsit_global) { if (!iscsit_global)
pr_err("Unable to allocate memory for iscsit_global\n");
return -1; return -1;
}
spin_lock_init(&iscsit_global->ts_bitmap_lock); spin_lock_init(&iscsit_global->ts_bitmap_lock);
mutex_init(&auth_id_lock); mutex_init(&auth_id_lock);
spin_lock_init(&sess_idr_lock); spin_lock_init(&sess_idr_lock);
...@@ -714,10 +710,8 @@ static int __init iscsi_target_init_module(void) ...@@ -714,10 +710,8 @@ static int __init iscsi_target_init_module(void)
size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long); size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
iscsit_global->ts_bitmap = vzalloc(size); iscsit_global->ts_bitmap = vzalloc(size);
if (!iscsit_global->ts_bitmap) { if (!iscsit_global->ts_bitmap)
pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
goto configfs_out; goto configfs_out;
}
lio_qr_cache = kmem_cache_create("lio_qr_cache", lio_qr_cache = kmem_cache_create("lio_qr_cache",
sizeof(struct iscsi_queue_req), sizeof(struct iscsi_queue_req),
...@@ -985,10 +979,8 @@ static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd) ...@@ -985,10 +979,8 @@ static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd)
iov_count += ISCSI_IOV_DATA_BUFFER; iov_count += ISCSI_IOV_DATA_BUFFER;
cmd->iov_data = kcalloc(iov_count, sizeof(*cmd->iov_data), GFP_KERNEL); cmd->iov_data = kcalloc(iov_count, sizeof(*cmd->iov_data), GFP_KERNEL);
if (!cmd->iov_data) { if (!cmd->iov_data)
pr_err("Unable to allocate cmd->iov_data\n");
return -ENOMEM; return -ENOMEM;
}
cmd->orig_iov_data_count = iov_count; cmd->orig_iov_data_count = iov_count;
return 0; return 0;
...@@ -1849,8 +1841,6 @@ static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -1849,8 +1841,6 @@ static int iscsit_handle_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
ping_data = kzalloc(payload_length + 1, GFP_KERNEL); ping_data = kzalloc(payload_length + 1, GFP_KERNEL);
if (!ping_data) { if (!ping_data) {
pr_err("Unable to allocate memory for"
" NOPOUT ping data.\n");
ret = -1; ret = -1;
goto out; goto out;
} }
...@@ -1998,13 +1988,10 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -1998,13 +1988,10 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
cmd->data_direction = DMA_NONE; cmd->data_direction = DMA_NONE;
cmd->tmr_req = kzalloc(sizeof(struct iscsi_tmr_req), GFP_KERNEL); cmd->tmr_req = kzalloc(sizeof(struct iscsi_tmr_req), GFP_KERNEL);
if (!cmd->tmr_req) { if (!cmd->tmr_req)
pr_err("Unable to allocate memory for"
" Task Management command!\n");
return iscsit_add_reject_cmd(cmd, return iscsit_add_reject_cmd(cmd,
ISCSI_REASON_BOOKMARK_NO_RESOURCES, ISCSI_REASON_BOOKMARK_NO_RESOURCES,
buf); buf);
}
/* /*
* TASK_REASSIGN for ERL=2 / connection stays inside of * TASK_REASSIGN for ERL=2 / connection stays inside of
...@@ -2264,11 +2251,9 @@ iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -2264,11 +2251,9 @@ iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
struct kvec iov[3]; struct kvec iov[3];
text_in = kzalloc(payload_length, GFP_KERNEL); text_in = kzalloc(payload_length, GFP_KERNEL);
if (!text_in) { if (!text_in)
pr_err("Unable to allocate memory for"
" incoming text parameters\n");
goto reject; goto reject;
}
cmd->text_in_ptr = text_in; cmd->text_in_ptr = text_in;
memset(iov, 0, 3 * sizeof(struct kvec)); memset(iov, 0, 3 * sizeof(struct kvec));
...@@ -3352,11 +3337,9 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, ...@@ -3352,11 +3337,9 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
SENDTARGETS_BUF_LIMIT); SENDTARGETS_BUF_LIMIT);
payload = kzalloc(buffer_len, GFP_KERNEL); payload = kzalloc(buffer_len, GFP_KERNEL);
if (!payload) { if (!payload)
pr_err("Unable to allocate memory for sendtargets"
" response.\n");
return -ENOMEM; return -ENOMEM;
}
/* /*
* Locate pointer to iqn./eui. string for ICF_SENDTARGETS_SINGLE * Locate pointer to iqn./eui. string for ICF_SENDTARGETS_SINGLE
* explicit case.. * explicit case..
......
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