@@ -69,7 +69,7 @@ static void json_update_attributes(nvme_ctrl_t c,
6969
7070static void json_parse_port (nvme_subsystem_t s , struct json_object * port_obj )
7171{
72- nvme_ctrl_t c , p ;
72+ nvme_ctrl_t c ;
7373 struct json_object * attr_obj ;
7474 const char * transport , * traddr = NULL ;
7575 const char * host_traddr = NULL , * host_iface = NULL , * trsvcid = NULL ;
@@ -90,18 +90,14 @@ static void json_parse_port(nvme_subsystem_t s, struct json_object *port_obj)
9090 attr_obj = json_object_object_get (port_obj , "trsvcid" );
9191 if (attr_obj )
9292 trsvcid = json_object_get_string (attr_obj );
93- p = NULL ;
94- do {
95- c = nvme_lookup_ctrl (s , transport , traddr , host_traddr ,
96- host_iface , trsvcid , p );
97- if (c ) {
98- attr_obj = json_object_object_get (port_obj , "dhchap_key" );
99- if (attr_obj )
100- nvme_ctrl_set_dhchap_key (c , json_object_get_string (attr_obj ));
101- json_update_attributes (c , port_obj );
102- }
103- p = c ;
104- } while (c );
93+ c = nvme_lookup_ctrl (s , transport , traddr , host_traddr ,
94+ host_iface , trsvcid , NULL );
95+ if (!c )
96+ return ;
97+ json_update_attributes (c , port_obj );
98+ attr_obj = json_object_object_get (port_obj , "dhchap_key" );
99+ if (attr_obj )
100+ nvme_ctrl_set_dhchap_key (c , json_object_get_string (attr_obj ));
105101}
106102
107103static void json_parse_subsys (nvme_host_t h , struct json_object * subsys_obj )
0 commit comments