Error handling for env_rwsem_init added

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski
2019-09-27 15:21:53 +02:00
parent b78557a2cc
commit 2575be83fa
3 changed files with 19 additions and 11 deletions

View File

@@ -302,11 +302,16 @@ int cleaning_policy_acp_initialize(struct ocf_cache *cache,
ocf_cache_log(cache, log_err, "acp context allocation error\n");
return -OCF_ERR_NO_MEM;
}
err = env_rwsem_init(&acp->chunks_lock);
if (err) {
env_vfree(acp);
return err;
}
cache->cleaner.cleaning_policy_context = acp;
acp->cache = cache;
env_rwsem_init(&acp->chunks_lock);
for (i = 0; i < ACP_MAX_BUCKETS; i++) {
INIT_LIST_HEAD(&acp->bucket_info[i].chunk_list);
acp->bucket_info[i].threshold =