Re: [patch] [SCSI] qla4xxx: don't free NULL dma pool

2013-01-30 Thread Vikas Chaudhary

-Original Message-
From: Dan Carpenter 
Date: Wednesday 30 January 2013 12:37 PM
To: Ravi Anand 
Cc: Vikas , Dept-Eng iSCSI Driver
, "James E.J. Bottomley"
, scsi ,
"kernel-janit...@vger.kernel.org" 
Subject: [patch] [SCSI] qla4xxx: don't free NULL dma pool

>The error path calls dma_pool_free() on this path but "chap_table" is
>NULL and "chap_dma" is uninitialized.  It's cleaner to just return
>directly.
>
>Signed-off-by: Dan Carpenter 
>
>diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c
>b/drivers/scsi/qla4xxx/ql4_mbx.c
>index 1c57c22..887e409 100644
>--- a/drivers/scsi/qla4xxx/ql4_mbx.c
>+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
>@@ -1404,10 +1404,8 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha,
>char *username, char *password,
>   dma_addr_t chap_dma;
>
>   chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
>-  if (chap_table == NULL) {
>-  ret = -ENOMEM;
>-  goto exit_get_chap;
>-  }
>+  if (chap_table == NULL)
>+  return -ENOMEM;
>
>   chap_size = sizeof(struct ql4_chap_table);
>   memset(chap_table, 0, chap_size);

Thanks for a fix.

Acked-by: Vikas Chaudhary 




This message and any attached documents contain information from QLogic 
Corporation or its wholly-owned subsidiaries that may be confidential. If you 
are not the intended recipient, you may not read, copy, distribute, or use this 
information. If you have received this transmission in error, please notify the 
sender immediately by reply e-mail and then delete this message.

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


[patch] [SCSI] qla4xxx: don't free NULL dma pool

2013-01-29 Thread Dan Carpenter
The error path calls dma_pool_free() on this path but "chap_table" is
NULL and "chap_dma" is uninitialized.  It's cleaner to just return
directly.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 1c57c22..887e409 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1404,10 +1404,8 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char 
*username, char *password,
dma_addr_t chap_dma;
 
chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
-   if (chap_table == NULL) {
-   ret = -ENOMEM;
-   goto exit_get_chap;
-   }
+   if (chap_table == NULL)
+   return -ENOMEM;
 
chap_size = sizeof(struct ql4_chap_table);
memset(chap_table, 0, chap_size);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html