diff --git a/src/common/gres.c b/src/common/gres.c
index 4bbf4b892680c6aac34834c7d4f15e663a2cc3e4..84a6265d6da6fb86912ebf5c20cee677a5e30050 100644
--- a/src/common/gres.c
+++ b/src/common/gres.c
@@ -751,12 +751,13 @@ extern int gres_plugin_node_config_load(uint32_t cpu_cnt)
 	struct stat config_stat;
 	s_p_hashtbl_t *tbl;
 	gres_slurmd_conf_t **gres_array;
-	char *gres_conf_file = _get_gres_conf();
+	char *gres_conf_file;
 
 	rc = gres_plugin_init();
 	if (gres_context_cnt == 0)
 		return SLURM_SUCCESS;
 
+	gres_conf_file = _get_gres_conf();
 	slurm_mutex_lock(&gres_context_lock);
 	gres_cpu_cnt = cpu_cnt;
 	if (stat(gres_conf_file, &config_stat) < 0)