public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: John Garry <john.garry@huawei.com>
Cc: "James E.J. Bottomley" <JBottomley@odin.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] hisi_sas: fix error codes in hisi_sas_task_prep()
Date: Wed, 9 Dec 2015 13:48:36 +0300	[thread overview]
Message-ID: <20151209104836.GK3173@mwanda> (raw)

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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 2929018..99b1950 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -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,

             reply	other threads:[~2015-12-09 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 10:48 Dan Carpenter [this message]
2015-12-09 13:29 ` [patch] hisi_sas: fix error codes in hisi_sas_task_prep() John Garry
2015-12-10 18:17 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151209104836.GK3173@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=JBottomley@odin.com \
    --cc=john.garry@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox