aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-08-16 21:21:38 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-10-10 23:31:09 +0200
commitfa2cd143bf381b06f86cce62f16dfa97f387c20d (patch)
tree130506c2bda218164dbf4cb56ef619e5f7f424cc /contrib
parent689a9945e658b714097652413976b639798150c8 (diff)
vhost-user-scsi: assert() in iscsi_add_lun()
Instead of a preliminary check, add an assert to the function that has the pre-condition. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/vhost-user-scsi/vhost-user-scsi.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c
index dd0de1fc89..0573ae794e 100644
--- a/contrib/vhost-user-scsi/vhost-user-scsi.c
+++ b/contrib/vhost-user-scsi/vhost-user-scsi.c
@@ -257,6 +257,7 @@ static int iscsi_add_lun(iscsi_lun_t *lun, char *iscsi_uri)
assert(lun);
assert(iscsi_uri);
+ assert(!lun->iscsi_ctx);
iscsi_ctx = iscsi_create_context(VUS_ISCSI_INITIATOR);
if (!iscsi_ctx) {
@@ -663,11 +664,6 @@ static int vdev_scsi_add_iscsi_lun(vhost_scsi_dev_t *vdev_scsi,
assert(iscsi_uri);
assert(lun < VUS_MAX_LUNS);
- if (vdev_scsi->luns[lun].iscsi_ctx) {
- PERR("Lun %d already configured", lun);
- return -1;
- }
-
if (iscsi_add_lun(&vdev_scsi->luns[lun], iscsi_uri) != 0) {
return -1;
}