Changeset 4f87a85a in mainline for uspace/drv/test


Ignore:
Timestamp:
2018-12-10T14:29:35Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ca4c5596
Parents:
433d52f
git-author:
Jiri Svoboda <jiri@…> (2018-12-10 07:39:07)
git-committer:
Jiri Svoboda <jiri@…> (2018-12-10 14:29:35)
Message:

Check return code from ddf_add_fun_to_category

Location:
uspace/drv/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/test/test1/test1.c

    r433d52f r4f87a85a  
    176176        }
    177177
    178         ddf_fun_add_to_category(fun_a, "virtual");
     178        rc = ddf_fun_add_to_category(fun_a, "virtual");
     179        if (rc != EOK) {
     180                ddf_msg(LVL_ERROR, "Failed adding function 'a' to category "
     181                    "'virtual'.");
     182                ddf_fun_unbind(fun_a);
     183                ddf_fun_destroy(fun_a);
     184                goto error;
     185        }
    179186
    180187        if (str_cmp(dev_name, "test1") == 0) {
  • uspace/drv/test/test2/test2.c

    r433d52f r4f87a85a  
    140140        rc = ddf_fun_bind(fun_a);
    141141        if (rc != EOK) {
     142                ddf_fun_destroy(fun_a);
    142143                ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
    143144                return rc;
    144145        }
    145146
    146         ddf_fun_add_to_category(fun_a, "virtual");
     147        rc = ddf_fun_add_to_category(fun_a, "virtual");
     148        if (rc != EOK) {
     149                ddf_fun_unbind(fun_a);
     150                ddf_fun_destroy(fun_a);
     151                ddf_msg(LVL_ERROR, "Failed adding function 'a' to category "
     152                    "'virtual'.");
     153                return rc;
     154        }
     155
    147156        test2->fun_a = fun_a;
    148157
  • uspace/drv/test/test3/test3.c

    r433d52f r4f87a85a  
    7070        errno_t rc;
    7171        char *fun_name = NULL;
     72        bool bound = false;
    7273
    7374        if (asprintf(&fun_name, "%s%zu", base_name, index) < 0) {
     
    9192        }
    9293
    93         ddf_fun_add_to_category(fun, class_name);
     94        bound = true;
     95
     96        rc = ddf_fun_add_to_category(fun, class_name);
     97        if (rc != EOK) {
     98                ddf_msg(LVL_ERROR, "Failed addning function %s to category %s: "
     99                    "%s", fun_name, class_name, str_error(rc));
     100                goto leave;
     101        }
    94102
    95103        ddf_msg(LVL_NOTE, "Registered exposed function `%s'.", fun_name);
     
    98106        free(fun_name);
    99107
     108        if (bound)
     109                ddf_fun_unbind(fun);
    100110        if ((rc != EOK) && (fun != NULL)) {
    101111                ddf_fun_destroy(fun);
Note: See TracChangeset for help on using the changeset viewer.