On 08/01/17 13:00, Github ODP bot wrote:
> +
> +int odp_module_install(void *dso, bool active)
> +{
> +     /* Bottom halves of the registration, context exclusion
> +      * is guaranteed by module_loader_start()
> +      */
> +     if (0 == odp_rwlock_write_trylock(&registration.lock)) {
> +             odp_subsystem_t *subsystem = registration.subsystem;
> +             odp_module_base_t *module = registration.module;
> +
> +             if (subsystem != NULL && module != NULL) {
> +                     odp_rwlock_write_lock(&subsystem->lock);
> +
> +                     module->handler = dso;
> +                     list_add_tail(&subsystem->modules, &module->list);
> +
> +                     /* install as active implementation */
> +                     if (active) /* warn: replaceable */
> +                             subsystem->active = module;
> +
> +                     odp_rwlock_write_unlock(&subsystem->lock);
> +             }
> +
> +             registration.subsystem = NULL;
> +             registration.module = NULL;
> +             return 0;
> +     }
> +
> +     odp_rwlock_write_unlock(&registration.lock);
> +     return -EACCES;
> +}
> +


Hello Yi,

you can save some place by shifting code one tab left here.

if (odp_rwlock_write_trylock(&registration.lock))
        return -EACCESS;


also if subsystem is null then 0 is returned. Might be also:
if (subsystem == NULL || module == NULL)  {
unlock();
return ERR;
}
......

Maxim.

Reply via email to