[PATCH 08/11] nvmet: fix eno.cocci warnings

Christoph Hellwig hch at lst.de
Wed Jun 8 05:31:03 PDT 2016


From: kbuild test robot <lkp at intel.com>

drivers/nvme/target/configfs.c:796:5-11: ERROR: allocation function on line 795 returns NULL not ERR_PTR on failure
drivers/nvme/target/configfs.c:739:5-11: ERROR: allocation function on line 738 returns NULL not ERR_PTR on failure

 The various basic memory allocation functions don't return ERR_PTR

Generated by: scripts/coccinelle/null/eno.cocci

CC: Christoph Hellwig <hch at lst.de>
Signed-off-by: Fengguang Wu <fengguang.wu 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 aebe646..9bed302 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -736,7 +736,7 @@ static struct config_group *nvmet_referral_make(
 	struct nvmet_port *port;
 
 	port = kzalloc(sizeof(*port), GFP_KERNEL);
-	if (IS_ERR(port))
+	if (!port)
 		return ERR_CAST(port);
 
 	INIT_LIST_HEAD(&port->entry);
@@ -793,7 +793,7 @@ static struct config_group *nvmet_ports_make(struct config_group *group,
 		return ERR_PTR(-EINVAL);
 
 	port = kzalloc(sizeof(*port), GFP_KERNEL);
-	if (IS_ERR(port))
+	if (!port)
 		return ERR_CAST(port);
 
 	INIT_LIST_HEAD(&port->entry);
-- 
2.1.4




More information about the Linux-nvme mailing list