diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-03-14 04:05:59 -0700 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-03-23 11:36:24 -0500 |
commit | 613640e4e1b5358ce880d16f10ecc2550b32b250 (patch) | |
tree | e3bf4cdc79a21df08fc44a4d5f79c4d56d3b8c78 /drivers/target/target_core_rd.c | |
parent | 5e8de4f3199446f5eeb371312da20534ebfe9979 (diff) |
[SCSI] target: Convert backend ->create_virtdevice() call to return ERR_PTR
This patch converts the target_core_store_dev_enable() -> struct
se_subsystem_api->create_virtdevice() call to return proper ERR_PTR values
back up to configfs logic during backend dependent struct se_device ENABLE
exception conditions.
Along with the change to target_core_configfs.c, this includes converting IBLOCK,
FILEIO, pSCSI, and RAMDISK_* backend subsystem plugins to obtain upper level
PTR_ERR return codes (where available), and return via ERR_PTR during a
*_create_virtdev() failure.
Reported-by: Fubo Chen <fubo.chen@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/target_core_rd.c')
-rw-r--r-- | drivers/target/target_core_rd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 8dc6d74c1d40..f36094f0596a 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -253,13 +253,15 @@ static struct se_device *rd_create_virtdevice( struct se_dev_limits dev_limits; struct rd_dev *rd_dev = p; struct rd_host *rd_host = hba->hba_ptr; - int dev_flags = 0; + int dev_flags = 0, ret = -EINVAL; char prod[16], rev[4]; memset(&dev_limits, 0, sizeof(struct se_dev_limits)); - if (rd_build_device_space(rd_dev) < 0) + if (rd_build_device_space(rd_dev) < 0) { + ret = -ENOMEM; goto fail; + } snprintf(prod, 16, "RAMDISK-%s", (rd_dev->rd_direct) ? "DR" : "MCP"); snprintf(rev, 4, "%s", (rd_dev->rd_direct) ? RD_DR_VERSION : @@ -292,7 +294,7 @@ static struct se_device *rd_create_virtdevice( fail: rd_release_device_space(rd_dev); - return NULL; + return ERR_PTR(ret); } static struct se_device *rd_DIRECT_create_virtdevice( |