Changes in / [aac12264:cd3e6a2] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libblock/libblock.c

    raac12264 rcd3e6a2  
    345345        link_t *l;
    346346        unsigned long key = boff;
    347         int rc = EOK;
     347        int rc;
    348348       
    349349        devcon = devcon_search(dev_handle);
     
    355355
    356356retry:
     357        rc = EOK;
     358        b = NULL;
     359
    357360        fibril_mutex_lock(&cache->lock);
    358361        l = hash_table_find(&cache->block_hash, &key);
     
    394397                        unsigned long temp_key;
    395398recycle:
    396                         assert(!list_empty(&cache->free_head));
     399                        if (list_empty(&cache->free_head)) {
     400                                fibril_mutex_unlock(&cache->lock);
     401                                rc = ENOMEM;
     402                                goto out;
     403                        }
    397404                        l = cache->free_head.next;
    398405                        b = list_get_instance(l, block_t, free_link);
     
    477484
    478485                fibril_mutex_unlock(&b->lock);
     486        }
     487out:
     488        if ((rc != EOK) && b) {
     489                assert(b->toxic);
     490                (void) block_put(b);
     491                b = NULL;
    479492        }
    480493        *block = b;
Note: See TracChangeset for help on using the changeset viewer.