Skip to contentSkip to conversation

hisi_sas: fix error codes in hisi_sas_task_prep()

PATCH Applied Dan Carpenter 3 participants 3 messages Dec 9, 2015 – Dec 10, 2015

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

PATCH 1/1 hisi_sas: fix error codes in hisi_sas_task_prep()

There were a couple cases where the error codes weren't set and also I changed the success return to "return 0;" which is the same as "return rc;" but more explicit.

Fixes 42e7a69368a5 ('hisi_sas: Add ssp command functio')
drivers/scsi/hisi_sas/hisi_sas_main.c +7 -3
index 2929018..99b1950 100644
@@ -208,15 +208,19 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
 	slot->status_buffer = dma_pool_alloc(hisi_hba->status_buffer_pool,
 					     GFP_ATOMIC,
 					     &slot->status_buffer_dma);
-	if (!slot->status_buffer)
+	if (!slot->status_buffer) {
+		rc = -ENOMEM;
 		goto err_out_slot_buf;
+	}
 	memset(slot->status_buffer, 0, HISI_SAS_STATUS_BUF_SZ);
 
 	slot->command_table = dma_pool_alloc(hisi_hba->command_table_pool,
 					     GFP_ATOMIC,
 					     &slot->command_table_dma);
-	if (!slot->command_table)
+	if (!slot->command_table) {
+		rc = -ENOMEM;
 		goto err_out_status_buf;
+	}
 	memset(slot->command_table, 0, HISI_SAS_COMMAND_TABLE_SZ);
 	memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));
 
@@ -254,7 +258,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
 	sas_dev->running_req++;
 	++(*pass);
 
-	return rc;
+	return 0;
 
 err_out_sge:
 	dma_pool_free(hisi_hba->sge_page_pool, slot->sge_page,
Tested-by on v1 1/1
#1 lore raw
Quoted 43 lines · Dan Carpenter

There were a couple cases where the error codes weren't set and also I changed the success return to "return 0;" which is the same as "return rc;" but more explicit.

Fixes 42e7a69368a5 ('hisi_sas: Add ssp command functio')
drivers/scsi/hisi_sas/hisi_sas_main.c +7 -4
index 2929018..99b1950 100644
@@ -208,15 +208,19 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
  	slot->status_buffer = dma_pool_alloc(hisi_hba->status_buffer_pool,
  					     GFP_ATOMIC,
  					     &slot->status_buffer_dma);
-	if (!slot->status_buffer)
+	if (!slot->status_buffer) {
+		rc = -ENOMEM;
  		goto err_out_slot_buf;
+	}
  	memset(slot->status_buffer, 0, HISI_SAS_STATUS_BUF_SZ);
 
  	slot->command_table = dma_pool_alloc(hisi_hba->command_table_pool,
  					     GFP_ATOMIC,
  					     &slot->command_table_dma);
-	if (!slot->command_table)
+	if (!slot->command_table) {
+		rc = -ENOMEM;
  		goto err_out_status_buf;
+	}
  	memset(slot->command_table, 0, HISI_SAS_COMMAND_TABLE_SZ);
  	memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));
 
@@ -254,7 +258,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
  	sas_dev->running_req++;
  	++(*pass);
 
-	return rc;
+	return 0;
 
  err_out_sge:
  	dma_pool_free(hisi_hba->sge_page_pool, slot->sge_page,
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Looks ok, Thanks.

#2 lore raw
In reply to Dan Carpenter
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dan" = Dan Carpenter <[email protected]> writes:

Dan> There were a couple cases where the error codes weren't set and Dan> also I changed the success return to "return 0;" which is the same Dan> as "return rc;" but more explicit.

Applied to 4.5/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering