Ignore:
Timestamp:
2023-10-22T17:55:33Z (14 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/hw/char/s3c24xx_uart/s3c24xx_uart.c

    r315d487 r1c6c3e1d  
    11/*
    2  * Copyright (c) 2010 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    8080int main(int argc, char *argv[])
    8181{
     82        loc_srv_t *srv;
     83
    8284        printf("%s: S3C24xx on-chip UART driver\n", NAME);
    8385
    8486        async_set_fallback_port_handler(s3c24xx_uart_connection, uart);
    85         errno_t rc = loc_server_register(NAME);
     87        errno_t rc = loc_server_register(NAME, &srv);
    8688        if (rc != EOK) {
    8789                printf("%s: Unable to register server.\n", NAME);
     
    9092
    9193        uart = malloc(sizeof(s3c24xx_uart_t));
    92         if (uart == NULL)
    93                 return -1;
    94 
    95         if (s3c24xx_uart_init(uart) != EOK)
    96                 return -1;
    97 
    98         rc = loc_service_register(NAMESPACE "/" NAME, &uart->service_id);
     94        if (uart == NULL) {
     95                loc_server_unregister(srv);
     96                return -1;
     97        }
     98
     99        if (s3c24xx_uart_init(uart) != EOK) {
     100                free(uart);
     101                loc_server_unregister(srv);
     102                return -1;
     103        }
     104
     105        rc = loc_service_register(srv, NAMESPACE "/" NAME, &uart->service_id);
    99106        if (rc != EOK) {
     107                // XXX s3c24xx_uart_fini(uart);
     108                free(uart);
     109                loc_server_unregister(srv);
    100110                printf(NAME ": Unable to register device %s.\n",
    101111                    NAMESPACE "/" NAME);
Note: See TracChangeset for help on using the changeset viewer.