Fix some clang warnings

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-02-21 16:13:53 -08:00
parent efedc02224
commit 5a80c7b581
6 changed files with 20 additions and 20 deletions

View File

@@ -561,12 +561,12 @@ void discovery_cb(struct iscsi_context *iscsi, int status, void *command_data, v
printf("discovery callback status:%04x\n", status);
if (status != 0) {
if (status != 0 || command_data == NULL) {
printf("Failed to do discovery on target. : %s\n", iscsi_get_error(iscsi));
exit(10);
}
for(addr=command_data; addr; addr=addr->next) {
for(addr = command_data; addr; addr = addr->next) {
printf("Target:%s Address:%s\n", addr->target_name, addr->portals->portal);
}

View File

@@ -149,7 +149,7 @@ mpath_check_matching_ids_devid_vpd(int num_sds,
SCSI_INQUIRY_PAGECODE_DEVICE_IDENTIFICATION,
64,
EXPECT_STATUS_GOOD);
if (inq_task && inq_task->status != SCSI_STATUS_GOOD) {
if (inq_task == NULL || inq_task->status != SCSI_STATUS_GOOD) {
printf("Inquiry command failed : %s\n",
sds[i]->error_str);
goto err_cleanup;
@@ -273,7 +273,7 @@ mpath_check_matching_ids_serial_vpd(int num_sds,
inquiry(sds[i], &inq_task, 1,
SCSI_INQUIRY_PAGECODE_UNIT_SERIAL_NUMBER, 64,
EXPECT_STATUS_GOOD);
if (inq_task && inq_task->status != SCSI_STATUS_GOOD) {
if (inq_task == NULL || inq_task->status != SCSI_STATUS_GOOD) {
printf("Inquiry command failed : %s\n",
sds[i]->error_str);
goto err_cleanup;

View File

@@ -337,7 +337,6 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
/* Where to store the sense_data, if there was an error */
io_hdr.sbp = sense;
io_hdr.mx_sb_len = sense_len;
sense_len=0;
/* Transfer direction, either in or out. Linux does not yet
support bidirectional SCSI transfers ?
@@ -386,7 +385,6 @@ static struct scsi_task *send_scsi_command(struct scsi_device *sdev, struct scsi
if(io_hdr.sb_len_wr > 0){
task->status = SCSI_STATUS_CHECK_CONDITION;
scsi_parse_sense_data(&task->sense, sense);
sense_len=io_hdr.sb_len_wr;
snprintf(buf, sizeof(buf), "SENSE KEY:%s(%d) ASCQ:%s(0x%04x)",
scsi_sense_key_str(task->sense.key),
task->sense.key,

View File

@@ -29,7 +29,6 @@
void
test_get_lba_status_unmap_single(void)
{
int ret;
uint64_t i;
struct unmap_list list[1];
struct scsi_task *t = NULL;
@@ -50,19 +49,17 @@ test_get_lba_status_unmap_single(void)
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
"pattern and thus map the blocks", 256 + lbppb);
ret = write10(sd, 0, (256 + lbppb) * block_size,
block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
WRITE10(sd, 0, (256 + lbppb) * block_size,
block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
for (i = 0; i + lbppb <= 256; i += lbppb) {
logging(LOG_VERBOSE, "Unmap a single physical block at LBA:%"
PRIu64 " (number of logical blocks: %d)", i, lbppb);
list[0].lba = i;
list[0].num = lbppb;
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
UNMAP(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read the status of the block at LBA:%"
PRIu64, i);
@@ -105,16 +102,15 @@ test_get_lba_status_unmap_single(void)
for (i = lbppb; i + lbppb <= 256; i += lbppb) {
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
"pattern and thus map the blocks", (256 + lbppb));
ret = write10(sd, 0, (256 + lbppb) * block_size,
block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
WRITE10(sd, 0, (256 + lbppb) * block_size,
block_size, 0, 0, 0, 0, 0, scratch,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Unmap %" PRIu64 " blocks at LBA 0", i);
list[0].lba = 0;
list[0].num = i;
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
UNMAP(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Read the status of the block at LBA:0");

View File

@@ -37,6 +37,9 @@ check_wabereq(void)
READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret);
if (task_ret == NULL) {
return;
}
CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED);
switch (inq_bdc->wabereq) {

View File

@@ -37,6 +37,9 @@ check_wacereq(void)
READ10(sd, &task_ret, 0, block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL_FATAL(task_ret);
if (task_ret == NULL) {
return;
}
CU_ASSERT_NOT_EQUAL(task_ret->status, SCSI_STATUS_CANCELLED);
switch (inq_bdc->wabereq) {