Skip to content

Commit fbc4040

Browse files
elfringNicholas Bellinger
authored andcommitted
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.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 55ec409 commit fbc4040

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

‎drivers/target/target_core_rd.c‎

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ static int rd_attach_hba(struct se_hba *hba, u32 host_id)
4848
struct rd_host *rd_host;
4949

5050
rd_host = kzalloc(sizeof(struct rd_host), GFP_KERNEL);
51-
if (!rd_host) {
52-
pr_err("Unable to allocate memory for struct rd_host\n");
51+
if (!rd_host)
5352
return -ENOMEM;
54-
}
5553

5654
rd_host->rd_host_id = host_id;
5755

@@ -148,11 +146,8 @@ static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *
148146

149147
sg = kcalloc(sg_per_table + chain_entry, sizeof(*sg),
150148
GFP_KERNEL);
151-
if (!sg) {
152-
pr_err("Unable to allocate scatterlist array"
153-
" for struct rd_dev\n");
149+
if (!sg)
154150
return -ENOMEM;
155-
}
156151

157152
sg_init_table(sg, sg_per_table + chain_entry);
158153

@@ -211,11 +206,8 @@ static int rd_build_device_space(struct rd_dev *rd_dev)
211206

212207
sg_tables = (total_sg_needed / max_sg_per_table) + 1;
213208
sg_table = kcalloc(sg_tables, sizeof(*sg_table), GFP_KERNEL);
214-
if (!sg_table) {
215-
pr_err("Unable to allocate memory for Ramdisk"
216-
" scatterlist tables\n");
209+
if (!sg_table)
217210
return -ENOMEM;
218-
}
219211

220212
rd_dev->sg_table_array = sg_table;
221213
rd_dev->sg_table_count = sg_tables;
@@ -271,11 +263,8 @@ static int rd_build_prot_space(struct rd_dev *rd_dev, int prot_length, int block
271263

272264
sg_tables = (total_sg_needed / max_sg_per_table) + 1;
273265
sg_table = kcalloc(sg_tables, sizeof(*sg_table), GFP_KERNEL);
274-
if (!sg_table) {
275-
pr_err("Unable to allocate memory for Ramdisk protection"
276-
" scatterlist tables\n");
266+
if (!sg_table)
277267
return -ENOMEM;
278-
}
279268

280269
rd_dev->sg_prot_array = sg_table;
281270
rd_dev->sg_prot_count = sg_tables;
@@ -297,10 +286,8 @@ static struct se_device *rd_alloc_device(struct se_hba *hba, const char *name)
297286
struct rd_host *rd_host = hba->hba_ptr;
298287

299288
rd_dev = kzalloc(sizeof(struct rd_dev), GFP_KERNEL);
300-
if (!rd_dev) {
301-
pr_err("Unable to allocate memory for struct rd_dev\n");
289+
if (!rd_dev)
302290
return NULL;
303-
}
304291

305292
rd_dev->rd_host = rd_host;
306293

0 commit comments

Comments
 (0)