    if (parent == NULL) {
 -    if (path == NULL) NCCLCHECK(getPciPath(busId, &path));
 +    NCCLCHECK(getPciPath(busId, path));
- 
+
      // Save that for later in case next step is a CPU
      char numaIdStr[MAX_STR_LEN];
 @@ -544,7 +546,6 @@ ncclResult_t ncclTopoGetXmlFromSys(struct ncclXmlNode* pciNode, struct ncclXml*

-  free(path);
   return ncclSuccess;
 }
 
@@ -644,8 +644,8 @@ ncclResult_t ncclTopoGetXmlFromGpu(struct ncclXmlNode* pciNode, nvmlDevice_t nvm
         // Remote NVLink device is not visible inside this VM. Assume NVSwitch.
         NCCLCHECK(xmlSetAttr(sub, "tclass", "0x068000"));

@@ -460,20 +460,21 @@ int checkBDFFormat(char* bdf) {
   return 1;
 }

-ncclResult_t ncclTopoGetXmlFromSys(struct ncclXmlNode* pciNode, struct ncclXml* xml) {
+ncclResult_t ncclTopoGetXmlNodeFromSys(struct ncclXmlNode* pciNode,
+                                       struct ncclXml* xml,
