aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-14 07:06:03 -0400
committerJames Bottomley <James.Bottomley@suse.de>2011-03-23 12:36:32 -0400
commit065f97161b2da30b13000b1d9f64adff7e01e270 (patch)
treea3b1bf5149d16aa9510abc407466c121ad7c643f /drivers/target
parent35ce9e26d7e0674892f77a9172c898dfcba50064 (diff)
[SCSI] target: Convert rd_build_device_space() to use errno
This patch converts rd_build_device_space() to return errno usage for failures in rd_create_virtdevice(). Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_rd.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index f36094f0596a..7837dd365a9d 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -150,7 +150,7 @@ static int rd_build_device_space(struct rd_dev *rd_dev)
150 if (rd_dev->rd_page_count <= 0) { 150 if (rd_dev->rd_page_count <= 0) {
151 printk(KERN_ERR "Illegal page count: %u for Ramdisk device\n", 151 printk(KERN_ERR "Illegal page count: %u for Ramdisk device\n",
152 rd_dev->rd_page_count); 152 rd_dev->rd_page_count);
153 return -1; 153 return -EINVAL;
154 } 154 }
155 total_sg_needed = rd_dev->rd_page_count; 155 total_sg_needed = rd_dev->rd_page_count;
156 156
@@ -160,7 +160,7 @@ static int rd_build_device_space(struct rd_dev *rd_dev)
160 if (!(sg_table)) { 160 if (!(sg_table)) {
161 printk(KERN_ERR "Unable to allocate memory for Ramdisk" 161 printk(KERN_ERR "Unable to allocate memory for Ramdisk"
162 " scatterlist tables\n"); 162 " scatterlist tables\n");
163 return -1; 163 return -ENOMEM;
164 } 164 }
165 165
166 rd_dev->sg_table_array = sg_table; 166 rd_dev->sg_table_array = sg_table;
@@ -175,7 +175,7 @@ static int rd_build_device_space(struct rd_dev *rd_dev)
175 if (!(sg)) { 175 if (!(sg)) {
176 printk(KERN_ERR "Unable to allocate scatterlist array" 176 printk(KERN_ERR "Unable to allocate scatterlist array"
177 " for struct rd_dev\n"); 177 " for struct rd_dev\n");
178 return -1; 178 return -ENOMEM;
179 } 179 }
180 180
181 sg_init_table((struct scatterlist *)&sg[0], sg_per_table); 181 sg_init_table((struct scatterlist *)&sg[0], sg_per_table);
@@ -191,7 +191,7 @@ static int rd_build_device_space(struct rd_dev *rd_dev)
191 if (!(pg)) { 191 if (!(pg)) {
192 printk(KERN_ERR "Unable to allocate scatterlist" 192 printk(KERN_ERR "Unable to allocate scatterlist"
193 " pages for struct rd_dev_sg_table\n"); 193 " pages for struct rd_dev_sg_table\n");
194 return -1; 194 return -ENOMEM;
195 } 195 }
196 sg_assign_page(&sg[j], pg); 196 sg_assign_page(&sg[j], pg);
197 sg[j].length = PAGE_SIZE; 197 sg[j].length = PAGE_SIZE;
@@ -253,15 +253,14 @@ static struct se_device *rd_create_virtdevice(
253 struct se_dev_limits dev_limits; 253 struct se_dev_limits dev_limits;
254 struct rd_dev *rd_dev = p; 254 struct rd_dev *rd_dev = p;
255 struct rd_host *rd_host = hba->hba_ptr; 255 struct rd_host *rd_host = hba->hba_ptr;
256 int dev_flags = 0, ret = -EINVAL; 256 int dev_flags = 0, ret;
257 char prod[16], rev[4]; 257 char prod[16], rev[4];
258 258
259 memset(&dev_limits, 0, sizeof(struct se_dev_limits)); 259 memset(&dev_limits, 0, sizeof(struct se_dev_limits));
260 260
261 if (rd_build_device_space(rd_dev) < 0) { 261 ret = rd_build_device_space(rd_dev);
262 ret = -ENOMEM; 262 if (ret < 0)
263 goto fail; 263 goto fail;
264 }
265 264
266 snprintf(prod, 16, "RAMDISK-%s", (rd_dev->rd_direct) ? "DR" : "MCP"); 265 snprintf(prod, 16, "RAMDISK-%s", (rd_dev->rd_direct) ? "DR" : "MCP");
267 snprintf(rev, 4, "%s", (rd_dev->rd_direct) ? RD_DR_VERSION : 266 snprintf(rev, 4, "%s", (rd_dev->rd_direct) ? RD_DR_VERSION :