Skip to content

Commit

Permalink
vhost-user-scsi: assert() in iscsi_add_lun()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
elmarco committed Oct 10, 2017
1 parent 689a994 commit fa2cd14
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions contrib/vhost-user-scsi/vhost-user-scsi.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit fa2cd14

Please sign in to comment.