mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 19:33:39 +08:00
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>
This commit is contained in:
parent
689a9945e6
commit
fa2cd143bf
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user