Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit bae87db

Browse files
Ralph Castainhppritcha
authored andcommitted
Silence a warning by converting the bitmap to a string prior to printing the error
1 parent 918650a commit bae87db

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

orte/mca/rtc/hwloc/rtc_hwloc.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,16 @@ static void set(orte_job_t *jobdat,
105105
rc = hwloc_set_cpubind(opal_hwloc_topology, sum->available, 0);
106106
/* if we got an error and this wasn't a default binding policy, then report it */
107107
if (rc < 0 && OPAL_BINDING_POLICY_IS_SET(jobdat->map->binding)) {
108-
char *tmp = NULL;
109108
if (errno == ENOSYS) {
110109
msg = "hwloc indicates cpu binding not supported";
111110
} else if (errno == EXDEV) {
112111
msg = "hwloc indicates cpu binding cannot be enforced";
113112
} else {
113+
char *tmp;
114+
(void)hwloc_bitmap_list_asprintf(&tmp, sum->available);
114115
asprintf(&msg, "hwloc_set_cpubind returned \"%s\" for bitmap \"%s\"",
115-
opal_strerror(rc), sum->available);
116+
opal_strerror(rc), tmp);
117+
free(tmp);
116118
}
117119
if (OPAL_BINDING_REQUIRED(jobdat->map->binding)) {
118120
/* If binding is required, send an error up the pipe (which exits
@@ -126,16 +128,8 @@ static void set(orte_job_t *jobdat,
126128
"help-orte-odls-default.txt", "not bound",
127129
orte_process_info.nodename, context->app, msg,
128130
__FILE__, __LINE__);
129-
if (NULL != tmp) {
130-
free(tmp);
131-
free(msg);
132-
}
133131
return;
134132
}
135-
if (NULL != tmp) {
136-
free(tmp);
137-
free(msg);
138-
}
139133
}
140134
}
141135
if (0 == rc && opal_hwloc_report_bindings) {

0 commit comments

Comments
 (0)