未验证 提交 e7daa282 编写于 作者: O openharmony_ci 提交者: Gitee

!1025 清除一些静态检查工具发现的问题

Merge pull request !1025 from Far/master
......@@ -780,7 +780,6 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
cnt = (bufLen - 1) < targetLen ? (bufLen - 1) : targetLen;
if (LOS_CopyFromKernel(buffer, bufLen, (const char *)f->target, cnt) != 0) {
cnt = 0;
LOS_MuxUnlock(&g_jffs2FsLock);
return -EFAULT;
}
......
......@@ -353,7 +353,7 @@ static struct file_operations_vfs g_errorFileOps = {
.unlink = ErrorFopUnlink,
};
static struct Mount* GetDevMountPoint(struct Vnode *dev)
static struct Mount* GetDevMountPoint(const struct Vnode *dev)
{
struct Mount *mnt = NULL;
LIST_HEAD *mntList = GetMountList();
......@@ -394,7 +394,7 @@ static void FilePreClose(struct file *filep, const struct file_operations_vfs *o
}
}
static void FileDisableAndClean(struct Mount *mnt)
static void FileDisableAndClean(const struct Mount *mnt)
{
struct filelist *flist = &tg_filelist;
struct file *filep = NULL;
......@@ -435,7 +435,7 @@ static void VnodeTryFree(struct Vnode *vnode)
vnode->fop = &g_errorFileOps;
}
static void VnodeTryFreeAll(struct Mount *mount)
static void VnodeTryFreeAll(const struct Mount *mount)
{
struct Vnode *vnode = NULL;
struct Vnode *nextVnode = NULL;
......
......@@ -66,7 +66,6 @@ static int iov_trans_to_buf(char *buf, ssize_t totallen, const struct iovec *iov
} else {
writepart = bytestowrite - ret;
curbuf += writepart;
totallen -= writepart;
break;
}
}
......
......@@ -70,7 +70,7 @@ VOID OsVmPhysDump(VOID);
VOID OsVmPhysUsedInfoGet(UINT32 *usedCount, UINT32 *totalCount);
INT32 OsRegionOverlapCheck(LosVmSpace *space, LosVmMapRegion *region);
VOID OsDumpPte(VADDR_T vaddr);
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space);
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space);
CHAR *OsArchFlagsToStr(const UINT32 archFlags);
#ifdef __cplusplus
......
......@@ -193,7 +193,7 @@ VOID OsVmmFileRegionFree(struct file *filep, LosProcessCB *processCB);
LosFilePage *OsPageCacheAlloc(struct page_mapping *mapping, VM_OFFSET_T pgoff);
LosFilePage *OsFindGetEntry(struct page_mapping *mapping, VM_OFFSET_T pgoff);
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr);
VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr);
VOID OsDelMapInfo(LosVmMapRegion *region, LosVmPgFault *pgFault, BOOL cleanDirty);
VOID OsFileCacheFlush(struct page_mapping *mapping);
......@@ -208,7 +208,7 @@ VOID OsDeletePageCacheLru(LosFilePage *page);
VOID OsPageRefDecNoLock(LosFilePage *page);
VOID OsPageRefIncLocked(LosFilePage *page);
int OsTryShrinkMemory(size_t nPage);
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, int off, int len);
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, int off, int len);
#ifdef LOSCFG_DEBUG_VERSION
VOID ResetPageCacheHitInfo(int *try, int *hit);
......
......@@ -96,7 +96,7 @@ UINT32 LOS_RwlockDestroy(LosRwlock *rwlock)
return LOS_OK;
}
STATIC UINT32 OsRwlockCheck(LosRwlock *rwlock)
STATIC UINT32 OsRwlockCheck(const LosRwlock *rwlock)
{
if (rwlock == NULL) {
return LOS_EINVAL;
......
......@@ -78,7 +78,6 @@ STATIC VOID OsMoveTmpInfoToUnbInfo(sig_cb *sigcb, INT32 signo)
/* delete tmpinfo from tmpList. */
*prevHook = tmpInfoNode->next;
(VOID)LOS_MemFree(m_aucSysMem0, tmpInfoNode);
tmpInfoNode = *prevHook;
break;
}
prevHook = &tmpInfoNode->next;
......
......@@ -918,7 +918,7 @@ STATIC UINT32 OsMemPoolAdd(VOID *pool, UINT32 size)
return LOS_OK;
}
STATIC UINT32 OsMemPoolDelete(VOID *pool)
STATIC UINT32 OsMemPoolDelete(const VOID *pool)
{
UINT32 ret = LOS_NOK;
VOID *nextPool = NULL;
......
......@@ -253,7 +253,7 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
return pmSize;
}
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
LosProcessCB *OsGetPIDByAspace(const LosVmSpace *space)
{
UINT32 pid;
UINT32 intSave;
......
......@@ -125,10 +125,10 @@ VOID OsAddMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
page->n_maps++;
}
LosMapInfo *OsGetMapInfo(LosFilePage *page, LosArchMmu *archMmu, VADDR_T vaddr)
LosMapInfo *OsGetMapInfo(const LosFilePage *page, const LosArchMmu *archMmu, VADDR_T vaddr)
{
LosMapInfo *info = NULL;
LOS_DL_LIST *immap = &page->i_mmap;
const LOS_DL_LIST *immap = &page->i_mmap;
LOS_DL_LIST_FOR_EACH_ENTRY(info, immap, LosMapInfo, node) {
if ((info->archMmu == archMmu) && (info->vaddr == vaddr) && (info->page == page)) {
......@@ -214,7 +214,7 @@ VOID OsVmmFileRemove(LosVmMapRegion *region, LosArchMmu *archMmu, VM_OFFSET_T pg
return;
}
VOID OsMarkPageDirty(LosFilePage *fpage, LosVmMapRegion *region, INT32 off, INT32 len)
VOID OsMarkPageDirty(LosFilePage *fpage, const LosVmMapRegion *region, INT32 off, INT32 len)
{
if (region != NULL) {
OsSetPageDirty(fpage->vmPage);
......
......@@ -233,7 +233,7 @@ LosVmSpace *OsCreateUserVmSpace(VOID)
return space;
}
STATIC BOOL OsVmSpaceParamCheck(LosVmSpace *vmSpace)
STATIC BOOL OsVmSpaceParamCheck(const LosVmSpace *vmSpace)
{
if (vmSpace == NULL) {
return FALSE;
......
......@@ -289,7 +289,7 @@ STATIC UINT32 OsPerfCollectData(Event *event, PerfSampleData *data, PerfRegs *re
* return TRUE if user haven't specified any taskId(which is supposed
* to instrument the whole system)
*/
STATIC INLINE BOOL OsFilterId(UINT32 id, UINT32 *ids, UINT8 idsNr)
STATIC INLINE BOOL OsFilterId(UINT32 id, const UINT32 *ids, UINT8 idsNr)
{
UINT32 i;
if (!idsNr) {
......
......@@ -300,7 +300,7 @@ UINT32 LOS_PmRegister(LOS_PmNodeType type, VOID *node)
return LOS_EINVAL;
}
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, LosPmDevice *device)
STATIC UINT32 OsPmDeviceUnregister(LosPmCB *pm, const LosPmDevice *device)
{
LOS_SpinLock(&g_pmSpin);
if (pm->device == device) {
......
......@@ -116,8 +116,8 @@ static UINT16 GetFreeVid(VOID)
for (i = 0; i < mapMaxNum; i++) {
num = idMap->bitMap[i];
for (j = 0; j < INT_BIT_COUNT; j++) {
if ((num & (1 << j)) == 0) {
num |= 1 << j;
if ((num & (1U << j)) == 0) {
num |= 1U << j;
idMap->bitMap[i] = num;
return (INT_BIT_COUNT * i + j);
}
......
......@@ -49,13 +49,13 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
UINT64 curTime;
curTime = LOS_CurrNanosec();
g_recordTime[g_saveIndex] = curTime - g_intPendTime;
if (g_saveIndex == MAX_RECORD_SIZE) {
g_saveIndex = 0;
}
dprintf("curTime = %lld, pendTime = %lld \n", curTime, g_intPendTime);
dprintf("%lld\n", curTime - g_intPendTime);
dprintf("[swtmr] hwi response time : ##%lld \n", g_recordTime[g_saveIndex]);
g_saveIndex++;
if (g_saveIndex == MAX_RECORD_SIZE) {
g_saveIndex = 0;
}
}
static VOID DumpResult()
......
......@@ -76,7 +76,7 @@ static void Task01(void)
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2);
ret = memset_s((void *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2;
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2);
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)Task04;
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
taskInitParam.pcName = "SmpCpup005_task04";
......
......@@ -65,7 +65,7 @@ static int GetHostByAddrTest(void)
addr = gethostbyaddr(&ia, sizeof ia, AF_INET);
ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno);
    RecoveryFileEnv(pathList, file_number);
RecoveryFileEnv(pathList, file_number);
return ICUNIT_SUCCESS;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册