diff options
Diffstat (limited to 'drivers/target/target_core_rd.c')
-rw-r--r-- | drivers/target/target_core_rd.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 8dc6d74c1d40..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,12 +253,13 @@ 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; | 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 | if (ret < 0) | ||
262 | goto fail; | 263 | goto fail; |
263 | 264 | ||
264 | snprintf(prod, 16, "RAMDISK-%s", (rd_dev->rd_direct) ? "DR" : "MCP"); | 265 | snprintf(prod, 16, "RAMDISK-%s", (rd_dev->rd_direct) ? "DR" : "MCP"); |
@@ -292,7 +293,7 @@ static struct se_device *rd_create_virtdevice( | |||
292 | 293 | ||
293 | fail: | 294 | fail: |
294 | rd_release_device_space(rd_dev); | 295 | rd_release_device_space(rd_dev); |
295 | return NULL; | 296 | return ERR_PTR(ret); |
296 | } | 297 | } |
297 | 298 | ||
298 | static struct se_device *rd_DIRECT_create_virtdevice( | 299 | static struct se_device *rd_DIRECT_create_virtdevice( |