提交 fa2cd143 编写于 作者: M Marc-André Lureau

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: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
上级 689a9945
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册