diff mbox series

[ndctl,05/37] cxl/json: Cleanup object leak false positive

Message ID 164298553566.3021641.11858634436119663877.stgit@dwillia2-desk3.amr.corp.intel.com
State New, archived
Headers show
Series cxl: Full topology enumeration | expand

Commit Message

Dan Williams Jan. 24, 2022, 12:52 a.m. UTC
As written it is a leak of the json object to return if devname is NULL.
However, the devname can not be NULL because the memdev would not have been
enumerated. Drop the error checking.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 cxl/json.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/cxl/json.c b/cxl/json.c
index 97ed76b65a6b..3ef9f7670510 100644
--- a/cxl/json.c
+++ b/cxl/json.c
@@ -190,7 +190,7 @@  struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
 	struct json_object *jdev, *jobj;
 
 	jdev = json_object_new_object();
-	if (!devname || !jdev)
+	if (!jdev)
 		return NULL;
 
 	jobj = json_object_new_string(devname);