@@ -1547,7 +1547,6 @@ lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, s
15471547 struct lysp_yin_ctx * yinctx = NULL ;
15481548 struct lysp_ctx * pctx = NULL ;
15491549 struct lysf_ctx fctx = {.ctx = ctx };
1550- const char * submod_name ;
15511550
15521551 LY_CHECK_ARG_RET (ctx , ctx , in , LY_EINVAL );
15531552
@@ -1592,21 +1591,19 @@ lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, s
15921591 submod -> latest_revision = 1 ;
15931592 }
15941593
1595- if (mod_data ) {
1596- /* check the parsed submodule it is as expected */
1597- r = lysp_load_module_data_check (ctx , NULL , submod , mod_data );
1598- if (r == LY_EEXIST ) {
1599- /* not an error, the submodule already exists so free this one */
1600- ly_set_erase (& pctx -> tpdfs_nodes , NULL );
1601- ly_set_erase (& pctx -> grps_nodes , NULL );
1602- ly_set_erase (& pctx -> ext_inst , NULL );
1603- lysp_module_free (& fctx , (struct lysp_module * )submod );
1604- submod = NULL ;
1605- goto cleanup ;
1606- } else if (r ) {
1607- rc = r ;
1608- goto cleanup ;
1609- }
1594+ /* check the parsed submodule is as expected */
1595+ r = lysp_load_module_data_check (ctx , NULL , submod , mod_data );
1596+ if (r == LY_EEXIST ) {
1597+ /* not an error, the submodule already exists so free this one */
1598+ ly_set_erase (& pctx -> tpdfs_nodes , NULL );
1599+ ly_set_erase (& pctx -> grps_nodes , NULL );
1600+ ly_set_erase (& pctx -> ext_inst , NULL );
1601+ lysp_module_free (& fctx , (struct lysp_module * )submod );
1602+ submod = NULL ;
1603+ goto cleanup ;
1604+ } else if (r ) {
1605+ rc = r ;
1606+ goto cleanup ;
16101607 }
16111608
16121609 if (latest_sp ) {
@@ -1620,19 +1617,7 @@ lys_parse_submodule(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, s
16201617
16211618cleanup :
16221619 if (rc ) {
1623- if (submod && submod -> name ) {
1624- submod_name = submod -> name ;
1625- } else if (mod_data ) {
1626- submod_name = mod_data -> name ;
1627- } else {
1628- submod_name = NULL ;
1629- }
1630- if (submod_name ) {
1631- LOGERR (ctx , rc , "Parsing submodule \"%s\" failed." , submod_name );
1632- } else {
1633- LOGERR (ctx , rc , "Parsing submodule failed." );
1634- }
1635-
1620+ LOGERR (ctx , rc , "Parsing submodule \"%s\" failed." , mod_data -> name );
16361621 if (pctx ) {
16371622 ly_set_erase (& pctx -> tpdfs_nodes , NULL );
16381623 ly_set_erase (& pctx -> grps_nodes , NULL );
0 commit comments