* [patch] hisi_sas: fix error codes in hisi_sas_task_prep()
@ 2015-12-09 10:48 Dan Carpenter
2015-12-09 13:29 ` John Garry
2015-12-10 18:17 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-12-09 10:48 UTC (permalink / raw)
To: John Garry
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
kernel-janitors
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,
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] hisi_sas: fix error codes in hisi_sas_task_prep()
2015-12-09 10:48 [patch] hisi_sas: fix error codes in hisi_sas_task_prep() Dan Carpenter
@ 2015-12-09 13:29 ` John Garry
2015-12-10 18:17 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: John Garry @ 2015-12-09 13:29 UTC (permalink / raw)
To: Dan Carpenter
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
kernel-janitors
On 09/12/2015 10:48, Dan Carpenter wrote:
> 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,
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Looks ok, Thanks.
Tested-by: John Garry <john.garry@huawei.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch] hisi_sas: fix error codes in hisi_sas_task_prep()
2015-12-09 10:48 [patch] hisi_sas: fix error codes in hisi_sas_task_prep() Dan Carpenter
2015-12-09 13:29 ` John Garry
@ 2015-12-10 18:17 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2015-12-10 18:17 UTC (permalink / raw)
To: Dan Carpenter
Cc: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
kernel-janitors
>>>>> "Dan" == Dan Carpenter <dan.carpenter@oracle.com> 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.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-10 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 10:48 [patch] hisi_sas: fix error codes in hisi_sas_task_prep() Dan Carpenter
2015-12-09 13:29 ` John Garry
2015-12-10 18:17 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox