From 8426d662cbf89e4ed290f26e9967a6a240184d41 Mon Sep 17 00:00:00 2001 From: Michal Rakowski Date: Fri, 27 Sep 2019 11:49:54 +0200 Subject: [PATCH] Changed err handling to BUG_ON in case of refcnt_int fail durign cache init. Since we do not expect that incrementing cache's reference counter during cache init will fail at any condition it is can be changed to an assert instead of error handling. Signed-off-by: Michal Rakowski --- src/mngt/ocf_mngt_cache.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index 06965f4..57f39de 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -568,10 +568,7 @@ static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params) goto lock_err; } - if (!ocf_refcnt_inc(&cache->refcnt.cache)){ - result = -OCF_ERR_START_CACHE_FAIL; - goto flush_mutex_err; - } + ENV_BUG_ON(!ocf_refcnt_inc(&cache->refcnt.cache)); /* start with freezed metadata ref counter to indicate detached device*/ ocf_refcnt_freeze(&cache->refcnt.metadata); @@ -586,8 +583,6 @@ static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params) return 0; -flush_mutex_err: - env_mutex_destroy(&cache->flush_mutex); lock_err: ocf_mngt_cache_lock_deinit(cache); alloc_err: