[Bugfix][T106BUG-628] fix rtc idx error
Change-Id: Id1adfedfe1f23487d6c6adb550b577ad749b5666
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c
index 7130fa1..5e44885 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/libscrtc/sc_rtc_timer.c
@@ -508,6 +508,8 @@
{
int ret = -1;
+ sc_rtc_user_cb_t *rtc_cb_exist = NULL;
+
if (client_id <= 0)
{
SCLOGD("client_id is invalid.\n");
@@ -515,24 +517,36 @@
}
ret = rtc_timer_del(rtc_id, client_id);
+ /* Started by AICoder, pid:j189fw1aabbb7d914c690841c092ac245366c5bb */
+ if(sc_rtc_cb.client_id == client_id)
+ {
+ pthread_mutex_lock(&g_rtc_timer_mutex);
+ rtc_cb_exist = sc_rtc_timer_find_by_id(rtc_id);
+ if(!rtc_cb_exist)
+ {
+ SCLOGD("rtc timer with id:%d does not exist!\n",rtc_id);
+ pthread_mutex_unlock(&g_rtc_timer_mutex);
+ return -1;
+ }
+ sc_rtc_timer_free_by_id(rtc_id);
+ pthread_mutex_unlock(&g_rtc_timer_mutex);
+ }
+ else if(sc_rtc_cb.alarm_modid == client_id)
+ {
+ pthread_mutex_lock(&g_rtc_poweroff_alarm_mutex);
+ rtc_cb_exist = sc_rtc_poweroff_alarm_find_by_id(rtc_id);
+ if(!rtc_cb_exist)
+ {
+ SCLOGD("rtc poweroff alarm with id:%d does not exist!\n",rtc_id);
+ pthread_mutex_unlock(&g_rtc_poweroff_alarm_mutex);
+ return -1;
+ }
+ sc_rtc_poweroff_alarm_free_by_id(rtc_id);
+ pthread_mutex_unlock(&g_rtc_poweroff_alarm_mutex);
+ }
+ /* Ended by AICoder, pid:j189fw1aabbb7d914c690841c092ac245366c5bb */
- if(sc_rtc_cb.client_id == client_id)
- {
- pthread_mutex_lock(&g_rtc_timer_mutex);
- sc_rtc_timer_free_by_id(rtc_id);
-
- pthread_mutex_unlock(&g_rtc_timer_mutex);
- }
-
- if(sc_rtc_cb.alarm_modid == client_id)
- {
- pthread_mutex_lock(&g_rtc_poweroff_alarm_mutex);
-
- sc_rtc_poweroff_alarm_free_by_id(rtc_id);
-
- pthread_mutex_unlock(&g_rtc_poweroff_alarm_mutex);
- }
return ret;
}