[PATCH] nvmet: don't check for NULL pointer before kfree in nvmet_host_release

Christoph Hellwig hch at lst.de
Sun Jul 17 22:01:41 PDT 2022


And add an empty line after the variable declaration.

Reported-by: kernel test robot <lkp at intel.com>
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/target/configfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 1b11f6a83bb6c..79ff382a5b145 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -1788,9 +1788,9 @@ static struct configfs_attribute *nvmet_host_attrs[] = {
 static void nvmet_host_release(struct config_item *item)
 {
 	struct nvmet_host *host = to_host(item);
+
 #ifdef CONFIG_NVME_TARGET_AUTH
-	if (host->dhchap_secret)
-		kfree(host->dhchap_secret);
+	kfree(host->dhchap_secret);
 #endif
 	kfree(host);
 }
-- 
2.30.2




More information about the Linux-nvme mailing list