From 39f914e073f3cc0492c3e311890d07874e9fbc13 Mon Sep 17 00:00:00 2001 From: "Yao.Liu" Date: Thu, 7 Sep 2017 21:23:48 +0800 Subject: [PATCH] vfm: fixed vfm bug on provider init PD#149448: vfm: fixed vfm bug on provider init if provider use_cnt init later, some one may have on peek/get use_cnt may become error. Change-Id: Ic4e416ab4ec6e0590ee095cbd1a8b40990537980 Signed-off-by: Yao.Liu --- drivers/amlogic/media/common/vfm/vframe_provider.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/media/common/vfm/vframe_provider.c b/drivers/amlogic/media/common/vfm/vframe_provider.c index 3a60462..54ead51 100644 --- a/drivers/amlogic/media/common/vfm/vframe_provider.c +++ b/drivers/amlogic/media/common/vfm/vframe_provider.c @@ -106,8 +106,11 @@ static inline int use_provider(struct vframe_provider_s *prov) if (prov) { ret = atomic_inc_return(&prov->use_cnt); - if (ret <= 0) + if (ret <= 0) { atomic_dec_return(&prov->use_cnt); + pr_err("%s: Error, provider error-%d\n", + prov->name, atomic_read(&prov->use_cnt)); + } } return ret > 0; } @@ -204,6 +207,7 @@ int vf_reg_provider(struct vframe_provider_s *prov) return -1; prov->traceget = NULL; prov->traceput = NULL; + atomic_set(&prov->use_cnt, 0);/*set it ready for use.*/ for (i = 0; i < MAX_PROVIDER_NUM; i++) { p = provider_table[i]; if (p) { @@ -232,7 +236,6 @@ int vf_reg_provider(struct vframe_provider_s *prov) } else { pr_err("%s: Error, provider_table full\n", __func__); } - atomic_set(&prov->use_cnt, 0);/*set it ready for use.*/ if (vfm_trace_enable & 1) prov->traceget = vftrace_alloc_trace(prov->name, 1, vfm_trace_num); -- 2.7.4