提交 0f9c0657 编写于 作者: Z zhushengle

fix: 修复嵌套过深和函数返回值处理问题

Signed-off-by: Nzhushengle <zhushengle@huawei.com>
Change-Id: I228bc8752fb82bced7f97e0529391dac2f1eb65a
上级 2c5a5817
...@@ -482,15 +482,15 @@ static int HiviewHieventWriteLogException(char *str, const int strlen) ...@@ -482,15 +482,15 @@ static int HiviewHieventWriteLogException(char *str, const int strlen)
if (leftBufLen > EVENT_INFO_PACK_BUF_LEN) { if (leftBufLen > EVENT_INFO_PACK_BUF_LEN) {
tempchr = strptr[EVENT_INFO_PACK_BUF_LEN - 1]; tempchr = strptr[EVENT_INFO_PACK_BUF_LEN - 1];
strptr[EVENT_INFO_PACK_BUF_LEN - 1] = '\0'; strptr[EVENT_INFO_PACK_BUF_LEN - 1] = '\0';
LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 1, (void)LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 1,
strptr, EVENT_INFO_PACK_BUF_LEN); strptr, EVENT_INFO_PACK_BUF_LEN);
leftBufLen -= (EVENT_INFO_PACK_BUF_LEN - 1); leftBufLen -= (EVENT_INFO_PACK_BUF_LEN - 1);
strptr += (EVENT_INFO_PACK_BUF_LEN - 1); strptr += (EVENT_INFO_PACK_BUF_LEN - 1);
strptr[0] = tempchr; strptr[0] = tempchr;
sentcnt++; sentcnt++;
} else { } else {
LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 0, (void)LogBufToException(0, 0, IDAP_LOGTYPE_CMD, 0,
strptr, leftBufLen); strptr, leftBufLen);
sentcnt++; sentcnt++;
break; break;
} }
...@@ -548,6 +548,6 @@ void HiviewHieventFlush(void) ...@@ -548,6 +548,6 @@ void HiviewHieventFlush(void)
{ {
// magic number 0x7BBE69BD for notify hiview to flush hievent file // magic number 0x7BBE69BD for notify hiview to flush hievent file
struct HiviewHievent *hievent = HiviewHieventCreate(0x7BBE69BD); struct HiviewHievent *hievent = HiviewHieventCreate(0x7BBE69BD);
HiviewHieventReport(hievent); (void)HiviewHieventReport(hievent);
HiviewHieventDestroy(hievent); HiviewHieventDestroy(hievent);
} }
...@@ -704,10 +704,6 @@ static uint32_t SendSmcCmd(uint32_t cmd, paddr_t cmdAddr, ...@@ -704,10 +704,6 @@ static uint32_t SendSmcCmd(uint32_t cmd, paddr_t cmdAddr,
register uint32_t r1 asm("r1") = cmdAddr; register uint32_t r1 asm("r1") = cmdAddr;
register uint32_t r2 asm("r2") = cmdType; register uint32_t r2 asm("r2") = cmdType;
register uint32_t r3 asm("r3") = 0; register uint32_t r3 asm("r3") = 0;
(void)r0;
(void)r1;
(void)r2;
(void)r3;
do { do {
__asm__ volatile( __asm__ volatile(
".ifnc %0, r0;.err;.endif;\n" ".ifnc %0, r0;.err;.endif;\n"
...@@ -742,7 +738,7 @@ int RawSmcSend(uint32_t cmd, paddr_t cmdAddr, ...@@ -742,7 +738,7 @@ int RawSmcSend(uint32_t cmd, paddr_t cmdAddr,
void SiqDump(paddr_t mode) void SiqDump(paddr_t mode)
{ {
RawSmcSend(TSP_REE_SIQ, mode, 0, false); (void)RawSmcSend(TSP_REE_SIQ, mode, 0, false);
DoCmdNeedArchivelog(); DoCmdNeedArchivelog();
} }
...@@ -1016,7 +1012,7 @@ void FiqShadowWorkFunc(uint64_t target) ...@@ -1016,7 +1012,7 @@ void FiqShadowWorkFunc(uint64_t target)
{ {
SmcCmdRetT secret = { SMC_EXIT_MAX, 0, target }; SmcCmdRetT secret = { SMC_EXIT_MAX, 0, target };
SmpSmcSend(TSP_REQUEST, SMC_OPS_START_FIQSHD, GetCurrentPid(), (void)SmpSmcSend(TSP_REQUEST, SMC_OPS_START_FIQSHD, GetCurrentPid(),
&secret, false); &secret, false);
return; return;
} }
...@@ -1430,7 +1426,7 @@ int TcNsSmcWithNoNr(TcNsSmcCmd *cmd) ...@@ -1430,7 +1426,7 @@ int TcNsSmcWithNoNr(TcNsSmcCmd *cmd)
static void SmcWorkNoWait(uint32_t type) static void SmcWorkNoWait(uint32_t type)
{ {
RawSmcSend(TSP_REQUEST, g_cmdPhys, type, true); (void)RawSmcSend(TSP_REQUEST, g_cmdPhys, type, true);
} }
static void SmcWorkSetCmdBuffer(struct work_struct *work) static void SmcWorkSetCmdBuffer(struct work_struct *work)
......
...@@ -679,20 +679,21 @@ void DelServiceFromDev(TcNsDevFile *dev, TcNsService *service) ...@@ -679,20 +679,21 @@ void DelServiceFromDev(TcNsDevFile *dev, TcNsService *service)
return; return;
} }
for (i = 0; i < SERVICES_MAX_COUNT; i++) { for (i = 0; i < SERVICES_MAX_COUNT; i++) {
if (dev->services[i] == service) { if (dev->services[i] != service) {
tlogd("dev->serviceRef[%u] = %u\n", i, dev->serviceRef[i]); continue;
if (dev->serviceRef[i] == 0) { }
tloge("Caution! No service to be deleted!\n"); tlogd("dev->serviceRef[%u] = %u\n", i, dev->serviceRef[i]);
break; if (dev->serviceRef[i] == 0) {
} tloge("Caution! No service to be deleted!\n");
dev->serviceRef[i]--;
if (!dev->serviceRef[i]) {
tlogd("del service %u from %u\n", i, dev->devFileId);
dev->services[i] = NULL;
PutServiceStruct(service);
}
break; break;
} }
dev->serviceRef[i]--;
if (!dev->serviceRef[i]) {
tlogd("del service %u from %u\n", i, dev->devFileId);
dev->services[i] = NULL;
PutServiceStruct(service);
}
break;
} }
} }
......
...@@ -150,23 +150,25 @@ static DECLARE_WORK(tc_notify_work, TcNotifyFn); ...@@ -150,23 +150,25 @@ static DECLARE_WORK(tc_notify_work, TcNotifyFn);
static struct workqueue_struct *g_tzSpiWq = NULL; static struct workqueue_struct *g_tzSpiWq = NULL;
#endif #endif
static void WalkCallback(struct NotifyContextTimer *tcNotifyDataTimer, struct TcNsCallback *callbackFuncT)
{
if (tcNotifyDataTimer->property.timerClass == TIMER_RTC) {
tlogd("start to call callback func\n");
callbackFuncT->callbackFunc((void *)(&(tcNotifyDataTimer->property)));
tlogd("end to call callback func\n");
} else if (tcNotifyDataTimer->property.timerClass == TIMER_GENERIC) {
tlogd("timer60 no callback func\n");
}
}
static void WalkCallbackList(struct NotifyContextTimer *tcNotifyDataTimer) static void WalkCallbackList(struct NotifyContextTimer *tcNotifyDataTimer)
{ {
struct TcNsCallback *callbackFuncT = NULL; struct TcNsCallback *callbackFuncT = NULL;
mutex_lock(&g_taCallbackFuncList.callbackListLock); mutex_lock(&g_taCallbackFuncList.callbackListLock);
list_for_each_entry(callbackFuncT, list_for_each_entry(callbackFuncT, &g_taCallbackFuncList.callbackList, head) {
&g_taCallbackFuncList.callbackList, head) { if (memcmp(callbackFuncT->uuid, tcNotifyDataTimer->uuid, UUID_SIZE) == 0) {
if (memcmp(callbackFuncT->uuid, tcNotifyDataTimer->uuid, WalkCallback(tcNotifyDataTimer, callbackFuncT);
UUID_SIZE) == 0) {
if (tcNotifyDataTimer->property.timerClass == TIMER_RTC) {
tlogd("start to call callback func\n");
callbackFuncT->callbackFunc(
(void *)(&(tcNotifyDataTimer->property)));
tlogd("end to call callback func\n");
} else if (tcNotifyDataTimer->property.timerClass == TIMER_GENERIC) {
tlogd("timer60 no callback func\n");
}
} }
} }
mutex_unlock(&g_taCallbackFuncList.callbackListLock); mutex_unlock(&g_taCallbackFuncList.callbackListLock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册