TRACE_OUT_OF_MEM cleanups

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3329 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2011-04-01 17:43:46 +00:00
parent 289811ccc5
commit d77d19286f
11 changed files with 39 additions and 42 deletions
+2 -2
View File
@@ -1705,8 +1705,8 @@ static int nop_out_start(struct iscsi_cmnd *cmnd)
cmnd->sg = sg = scst_alloc(size, GFP_KERNEL,
&cmnd->sg_cnt);
if (sg == NULL) {
TRACE(TRACE_OUT_OF_MEM, "Allocating buffer for"
" %d Nop-Out payload failed", size);
TRACE(TRACE_OUT_OF_MEM, "Allocation of buffer "
"for %d Nop-Out payload failed", size);
err = -ISCSI_REASON_OUT_OF_RESOURCES;
goto out;
}
+3 -4
View File
@@ -5306,8 +5306,8 @@ static int q2t_get_target_name(uint8_t *wwn, char **ppwwn_name)
name = kmalloc(wwn_len, GFP_KERNEL);
if (name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "qla2x00t: Allocation of tgt "
"name failed");
PRINT_ERROR("qla2x00t: Allocation of tgt wwn name (size %d) "
"failed", wwn_len);
res = -ENOMEM;
goto out;
}
@@ -5709,8 +5709,7 @@ static int q2t_add_target(scsi_qla_host_t *ha)
tgt = kzalloc(sizeof(*tgt), GFP_KERNEL);
if (tgt == NULL) {
TRACE(TRACE_OUT_OF_MEM, "qla2x00t: %s", "Allocation of tgt "
"failed");
PRINT_ERROR("qla2x00t: %s", "Allocation of tgt failed");
res = -ENOMEM;
goto out;
}
+4 -3
View File
@@ -83,15 +83,16 @@ static int cdrom_attach(struct scst_device *dev)
params = kzalloc(sizeof(*params), GFP_KERNEL);
if (params == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct cdrom_params");
PRINT_ERROR("Unable to allocate struct cdrom_params (size %d)",
sizeof(*params));
res = -ENOMEM;
goto out;
}
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
PRINT_ERROR("Buffer memory allocation (size %d) failure",
buffer_size);
res = -ENOMEM;
goto out_free_params;
}
+4 -3
View File
@@ -181,15 +181,16 @@ static int disk_attach(struct scst_device *dev)
params = kzalloc(sizeof(*params), GFP_KERNEL);
if (params == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct disk_params");
PRINT_ERROR("Unable to allocate struct disk_params (size %d)",
sizeof(*params));
res = -ENOMEM;
goto out;
}
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
PRINT_ERROR("Buffer memory allocation (size %d) failure",
buffer_size);
res = -ENOMEM;
goto out_free_params;
}
+4 -3
View File
@@ -168,8 +168,8 @@ static int modisk_attach(struct scst_device *dev)
params = kzalloc(sizeof(*params), GFP_KERNEL);
if (params == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct modisk_params");
PRINT_ERROR("Unable to allocate struct modisk_params (size %d)",
sizeof(*params));
res = -ENOMEM;
goto out;
}
@@ -187,7 +187,8 @@ static int modisk_attach(struct scst_device *dev)
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
PRINT_ERROR("Buffer memory allocation (size %d) failure",
buffer_size);
res = -ENOMEM;
goto out_free_params;
}
+4 -3
View File
@@ -171,8 +171,8 @@ static int tape_attach(struct scst_device *dev)
params = kzalloc(sizeof(*params), GFP_KERNEL);
if (params == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Unable to allocate struct tape_params");
PRINT_ERROR("Unable to allocate struct tape_params (size %d)",
sizeof(*params));
res = -ENOMEM;
goto out;
}
@@ -181,7 +181,8 @@ static int tape_attach(struct scst_device *dev)
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Memory allocation failure");
PRINT_ERROR("Buffer memory allocation (size %d) failure",
buffer_size);
res = -ENOMEM;
goto out_free_req;
}
+5 -8
View File
@@ -842,8 +842,8 @@ static struct scst_vdisk_thr *vdisk_init_thr_data(
res = kmem_cache_zalloc(vdisk_thr_cachep, gfp_mask);
if (res == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Unable to allocate struct "
"scst_vdisk_thr");
PRINT_ERROR("Unable to allocate struct scst_vdisk_thr (size %d)",
sizeof(*res));
goto out;
}
@@ -3894,8 +3894,7 @@ static int vcdrom_change(struct scst_vdisk_dev *virt_dev,
if (!virt_dev->cdrom_empty) {
char *fn = kstrdup(filename, GFP_KERNEL);
if (fn == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of filename failed");
PRINT_ERROR("%s", "Allocation of filename failed");
res = -ENOMEM;
goto out_unlock;
}
@@ -4715,8 +4714,7 @@ static int vdisk_write_proc(char *buffer, char **start, off_t offset,
virt_dev->filename = kstrdup(filename, GFP_KERNEL);
if (virt_dev->filename == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of filename failed");
PRINT_ERROR("%s", "Allocation of filename failed");
res = -ENOMEM;
goto out_free_vdev;
}
@@ -4915,8 +4913,7 @@ static int vcdrom_open(char *p, char *name)
if (!virt_dev->cdrom_empty) {
virt_dev->filename = kstrdup(filename, GFP_KERNEL);
if (virt_dev->filename == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of filename failed");
PRINT_ERROR("%s", "Allocation of filename failed");
res = -ENOMEM;
goto out_free_vdev;
}
+5 -9
View File
@@ -2514,7 +2514,7 @@ int scst_alloc_tgt(struct scst_tgt_template *tgtt, struct scst_tgt **tgt)
t = kzalloc(sizeof(*t), GFP_KERNEL);
if (t == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of tgt failed");
PRINT_ERROR("%s", "Allocation of tgt failed");
res = -ENOMEM;
goto out;
}
@@ -2573,8 +2573,7 @@ int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev)
dev = kzalloc(sizeof(*dev), gfp_mask);
if (dev == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of scst_device failed");
PRINT_ERROR("%s", "Allocation of scst_device failed");
res = -ENOMEM;
goto out;
}
@@ -2653,8 +2652,7 @@ static struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg,
res = kmem_cache_zalloc(scst_acgd_cachep, GFP_KERNEL);
if (res == NULL) {
TRACE(TRACE_OUT_OF_MEM,
"%s", "Allocation of scst_acg_dev failed");
PRINT_ERROR("%s", "Allocation of scst_acg_dev failed");
goto out;
}
@@ -3287,8 +3285,7 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
tgt_dev = kmem_cache_zalloc(scst_tgtd_cachep, GFP_KERNEL);
if (tgt_dev == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_tgt_dev "
"failed");
PRINT_ERROR("%s", "Allocation of scst_tgt_dev failed");
res = -ENOMEM;
goto out;
}
@@ -3914,8 +3911,7 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask,
sess = kmem_cache_zalloc(scst_sess_cachep, gfp_mask);
if (sess == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s",
"Allocation of scst_session failed");
PRINT_ERROR("%s", "Allocation of scst_session failed");
goto out;
}
+3 -3
View File
@@ -488,7 +488,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
SCST_DEFAULT_ACG_NAME,
target_name);
if (tgt->default_group_name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "Allocation of default "
PRINT_ERROR("Allocation of default "
"group name failed (tgt %s)", target_name);
rc = -ENOMEM;
goto out_free_tgt;
@@ -498,7 +498,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
tgt->tgt_name = kstrdup(target_name, GFP_KERNEL);
if (tgt->tgt_name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "Allocation of tgt name %s failed",
PRINT_ERROR("Allocation of tgt name %s failed",
target_name);
rc = -ENOMEM;
goto out_free_tgt;
@@ -509,7 +509,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt,
tgt->tgt_name = kasprintf(GFP_KERNEL, "%s%s%d", vtt->name,
SCST_DEFAULT_TGT_NAME_SUFFIX, tgt_num);
if (tgt->tgt_name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "Allocation of tgt name failed "
PRINT_ERROR("Allocation of tgt name failed "
"(template name %s)", vtt->name);
rc = -ENOMEM;
goto out_free_tgt;
+3 -2
View File
@@ -1435,7 +1435,7 @@ static int sgv_pool_init(struct sgv_pool *pool, const char *name,
for (i = 0; i < pool->max_caches; i++) {
sgv_pool_init_cache(pool, i);
if (pool->caches[i] == NULL) {
TRACE(TRACE_OUT_OF_MEM, "Allocation of sgv_pool "
PRINT_ERROR("Allocation of sgv_pool "
"cache %s(%d) failed", name, i);
goto out_free;
}
@@ -1647,7 +1647,8 @@ struct sgv_pool *sgv_pool_create(const char *name,
pool = kzalloc(sizeof(*pool), GFP_KERNEL);
if (pool == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of sgv_pool failed");
PRINT_ERROR("Allocation of sgv_pool failed (size %d)",
sizeof(*pool));
goto out_unlock;
}
+2 -2
View File
@@ -931,7 +931,7 @@ static int scst_proc_group_add(const char *p, unsigned int addr_method)
name = kmalloc(len, GFP_KERNEL);
if (name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of name failed");
PRINT_ERROR("Allocation of new name (size %d) failed", len);
goto out_nomem;
}
strlcpy(name, p, len);
@@ -997,7 +997,7 @@ static int scst_proc_rename_acg(struct scst_acg *acg, const char *new_name)
name = kmalloc(len, GFP_KERNEL);
if (name == NULL) {
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of new name failed");
PRINT_ERROR("Allocation of new name (size %d) failed", len);
goto out_nomem;
}
strlcpy(name, new_name, len);