Changeset 1c6c3e1d in mainline for uspace/srv/test/chardev-test/main.c


Ignore:
Timestamp:
2023-10-22T17:55:33Z (15 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
ticket/834-toolchain-update
Children:
350ec74
Parents:
315d487 (diff), 133461c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/test/chardev-test/main.c

    r315d487 r1c6c3e1d  
    11/*
    2  * Copyright (c) 2017 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    118118{
    119119        errno_t rc;
     120        loc_srv_t *srv;
    120121
    121122        printf("%s: Character device test service\n", NAME);
    122123        async_set_fallback_port_handler(chardev_test_connection, NULL);
    123124
    124         rc = loc_server_register(NAME);
     125        rc = loc_server_register(NAME, &srv);
    125126        if (rc != EOK) {
    126127                printf("%s: Failed registering server.: %s\n", NAME, str_error(rc));
     
    140141        partialx_srvs.sarg = NULL;
    141142
    142         rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_SMALLX, &smallx_svc_id);
     143        rc = loc_service_register(srv, SERVICE_NAME_CHARDEV_TEST_SMALLX,
     144            &smallx_svc_id);
    143145        if (rc != EOK) {
    144146                printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
    145                 return rc;
    146         }
    147 
    148         rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_LARGEX, &largex_svc_id);
     147                goto error;
     148        }
     149
     150        rc = loc_service_register(srv, SERVICE_NAME_CHARDEV_TEST_LARGEX,
     151            &largex_svc_id);
    149152        if (rc != EOK) {
    150153                printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
    151                 return rc;
    152         }
    153 
    154         rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_PARTIALX, &partialx_svc_id);
     154                goto error;
     155        }
     156
     157        rc = loc_service_register(srv, SERVICE_NAME_CHARDEV_TEST_PARTIALX,
     158            &partialx_svc_id);
    155159        if (rc != EOK) {
    156160                printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
    157                 return rc;
     161                goto error;
    158162        }
    159163
     
    164168        /* Not reached */
    165169        return 0;
     170error:
     171        if (smallx_svc_id != 0)
     172                loc_service_unregister(srv, smallx_svc_id);
     173        if (largex_svc_id != 0)
     174                loc_service_unregister(srv, largex_svc_id);
     175        if (partialx_svc_id != 0)
     176                loc_service_unregister(srv, partialx_svc_id);
     177        loc_server_unregister(srv);
     178        return rc;
    166179}
    167180
Note: See TracChangeset for help on using the changeset viewer.