Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ps2mouse/main.c

    rb2010e2 r267f235  
    8080static int mouse_add(ddf_dev_t *device)
    8181{
    82         int rc;
    83 
    8482        if (!device)
    8583                return EINVAL;
    8684
     85#define CHECK_RET_RETURN(ret, message...) \
     86if (ret != EOK) { \
     87        ddf_msg(LVL_ERROR, message); \
     88        return ret; \
     89} else (void)0
     90
    8791        ps2_mouse_t *mouse = ddf_dev_data_alloc(device, sizeof(ps2_mouse_t));
    88         if (mouse == NULL) {
    89                 ddf_msg(LVL_ERROR, "Failed to allocate mouse driver instance.");
    90                 return ENOMEM;
    91         }
     92        int ret = (mouse == NULL) ? ENOMEM : EOK;
     93        CHECK_RET_RETURN(ret, "Failed to allocate mouse driver instance.");
    9294
    93         rc = ps2_mouse_init(mouse, device);
    94         if (rc != EOK) {
    95                 ddf_msg(LVL_ERROR, "Failed to initialize mouse driver: %s.",
    96                     str_error(rc));
    97                 return rc;
    98         }
     95        ret = ps2_mouse_init(mouse, device);
     96        CHECK_RET_RETURN(ret,
     97            "Failed to initialize mouse driver: %s.", str_error(ret));
    9998
    10099        ddf_msg(LVL_NOTE, "Controlling '%s' (%" PRIun ").",
Note: See TracChangeset for help on using the changeset viewer.