linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Li <abaci-bugfix@linux.alibaba.com>
To: jejb@linux.ibm.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yang Li <abaci-bugfix@linux.alibaba.com>
Subject: [PATCH 2/2] scsi: qla4xxx: remove redundant NULL check
Date: Fri, 22 Jan 2021 17:16:27 +0800	[thread overview]
Message-ID: <1611306987-103954-2-git-send-email-abaci-bugfix@linux.alibaba.com> (raw)
In-Reply-To: <1611306987-103954-1-git-send-email-abaci-bugfix@linux.alibaba.com>

Fix below warnings reported by coccicheck:
./drivers/scsi/qla4xxx/ql4_os.c:4171:2-7: WARNING: NULL check before
some freeing functions is not needed.
./drivers/scsi/qla4xxx/ql4_os.c:4192:2-7: WARNING: NULL check before
some freeing functions is not needed.
./drivers/scsi/qla4xxx/ql4_os.c:4211:2-7: WARNING: NULL check before
some freeing functions is not needed.
./drivers/scsi/qla4xxx/ql4_os.c:6396:2-7: WARNING: NULL check before
some freeing functions is not needed.
./drivers/scsi/qla4xxx/ql4_os.c:6551:2-7: WARNING: NULL check before
some freeing functions is not needed.
./drivers/scsi/qla4xxx/ql4_os.c:7840:2-7: WARNING: NULL check before
some freeing functions is not needed.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
---
 drivers/scsi/qla4xxx/ql4_os.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index a4b014e..73b89fd 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4171,8 +4171,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 		dma_free_coherent(&ha->pdev->dev, ha->queues_len, ha->queues,
 				  ha->queues_dma);
 
-	if (ha->fw_dump)
-		vfree(ha->fw_dump);
+	vfree(ha->fw_dump);
 
 	ha->queues_len = 0;
 	ha->queues = NULL;
@@ -4192,8 +4191,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 
 	dma_pool_destroy(ha->chap_dma_pool);
 
-	if (ha->chap_list)
-		vfree(ha->chap_list);
+	vfree(ha->chap_list);
 	ha->chap_list = NULL;
 
 	dma_pool_destroy(ha->fw_ddb_dma_pool);
@@ -4211,8 +4209,7 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
 		iounmap(ha->reg);
 	}
 
-	if (ha->reset_tmplt.buff)
-		vfree(ha->reset_tmplt.buff);
+	vfree(ha->reset_tmplt.buff);
 
 	pci_release_regions(ha->pdev);
 }
@@ -6396,10 +6393,8 @@ static int qla4xxx_is_session_exists(struct scsi_qla_host *ha,
 	}
 
 exit_check:
-	if (fw_tddb)
-		vfree(fw_tddb);
-	if (tmp_tddb)
-		vfree(tmp_tddb);
+	vfree(fw_tddb);
+	vfree(tmp_tddb);
 	return ret;
 }
 
@@ -6551,10 +6546,8 @@ static int qla4xxx_is_flash_ddb_exists(struct scsi_qla_host *ha,
 	}
 
 exit_check:
-	if (fw_tddb)
-		vfree(fw_tddb);
-	if (tmp_tddb)
-		vfree(tmp_tddb);
+	vfree(fw_tddb);
+	vfree(tmp_tddb);
 	return ret;
 }
 
@@ -7834,10 +7827,8 @@ static int qla4xxx_sysfs_ddb_logout(struct iscsi_bus_flash_session *fnode_sess,
 		ret = -ESRCH;
 
 exit_ddb_logout:
-	if (flash_tddb)
-		vfree(flash_tddb);
-	if (tmp_tddb)
-		vfree(tmp_tddb);
+	vfree(flash_tddb);
+	vfree(tmp_tddb);
 	if (fw_ddb_entry)
 		dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma);
 
-- 
1.8.3.1


  reply	other threads:[~2021-01-22  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  9:16 [PATCH 1/2] scsi: qla2xxx: remove redundant NULL check Yang Li
2021-01-22  9:16 ` Yang Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-22  9:02 Yang Li
2021-01-22  9:02 ` [PATCH 2/2] scsi: qla4xxx: " Yang Li

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=1611306987-103954-2-git-send-email-abaci-bugfix@linux.alibaba.com \
    --to=abaci-bugfix@linux.alibaba.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).