Skip to contentSkip to conversation

be2iscsi: correct return value in mgmt_invalidate_icds()

PATCH In review Dan Carpenter 2 participants 2 messages May 7, 2010 – May 8, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 be2iscsi: correct return value in mgmt_invalidate_icds()

This function should return 0 on error. Returning -1 would cause a crash.

Also there is an extra space before the newline character and a missing space between the "for" and the "mgmt_invalidate_icds". I put the string on one line. The current version of checkpatch.pl complains that the line is too long, but it makes grepping easier.

drivers/scsi/be2iscsi/be_mgmt.c +2 -3
index e641922..350cbea 100644
@@ -167,10 +167,9 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
 				&nonemb_cmd.dma);
 	if (nonemb_cmd.va == NULL) {
 		SE_DEBUG(DBG_LVL_1,
-			 "Failed to allocate memory for"
-			 "mgmt_invalidate_icds \n");
+			 "Failed to allocate memory for mgmt_invalidate_icds\n");
 		spin_unlock(&ctrl->mbox_lock);
-		return -1;
+		return 0;
 	}
 	nonemb_cmd.size = sizeof(struct invalidate_commands_params_in);
 	req = nonemb_cmd.va;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Dan Carpenter

This function should return 0 on error. Returning -1 would cause a crash.

Also there is an extra space before the newline character and a missing space between the "for" and the "mgmt_invalidate_icds". I put the string on one line. The current version of checkpatch.pl complains that the line is too long, but it makes grepping easier.

drivers/scsi/be2iscsi/be_mgmt.c +0 -0
index e641922..350cbea 100644
@@ -167,10 +167,9 @@ unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba,
  				&nonemb_cmd.dma);
  	if (nonemb_cmd.va == NULL) {

drivers/scsi/be2iscsi/be_mgmt.c unsigned char mgmt_invalidate_icds(struct beiscsi_hba *phba, · line 175

Quoted 10 lines
drivers/scsi/be2iscsi/be_mgmt.c +2 -3
  		SE_DEBUG(DBG_LVL_1,
-			 "Failed to allocate memory for"
-			 "mgmt_invalidate_icds \n");
+			 "Failed to allocate memory for mgmt_invalidate_icds\n");
  		spin_unlock(&ctrl->mbox_lock);
-		return -1;
+		return 0;
  	}
  	nonemb_cmd.size = sizeof(struct invalidate_commands_params_in);
  	req = nonemb_cmd.va;

You are right. Nice catch.