fix: 修复一些静态扫描工具发现的问题

Change-Id: I4890de0066f33bf44e913b550edfa3639bce7caf
Signed-off-by: Far <yesiyuan2@huawei.com>
This commit is contained in:
Far 2022-10-15 17:35:52 +08:00
parent a7135e252d
commit 296a546bcd
5 changed files with 4 additions and 10 deletions

View File

@ -39,7 +39,7 @@
static struct File g_files[NR_OPEN_DEFAULT]; static struct File g_files[NR_OPEN_DEFAULT];
int FileToFd(struct File *file) int FileToFd(const struct File *file)
{ {
if (file == NULL) { if (file == NULL) {
return (int)LOS_NOK; return (int)LOS_NOK;

View File

@ -89,7 +89,7 @@ struct Dir {
void *dData; void *dData;
}; };
int FileToFd(struct File *file); int FileToFd(const struct File *file);
struct File *FdToFile(int fd); struct File *FdToFile(int fd);
struct File *VfsFileGet(void); struct File *VfsFileGet(void);
struct File *VfsFileGetSpec(int fd); struct File *VfsFileGetSpec(int fd);

View File

@ -251,7 +251,7 @@ errout:
return (int)LOS_NOK; return (int)LOS_NOK;
} }
static void CloseFdsInMp(struct MountPoint *mp) static void CloseFdsInMp(const struct MountPoint *mp)
{ {
for (int fd = 0; fd < NR_OPEN_DEFAULT; fd++) { for (int fd = 0; fd < NR_OPEN_DEFAULT; fd++) {
struct File *f = FdToFile(fd); struct File *f = FdToFile(fd);

View File

@ -175,7 +175,7 @@ STATIC INLINE INT32 PollTimedWait(struct pollfd *fds, nfds_t nfds, struct PollTa
} }
} else if (left <= 0) { } else if (left <= 0) {
break; break;
} else if (left > 0) { } else {
clock_gettime(CLOCK_REALTIME, &curTime); clock_gettime(CLOCK_REALTIME, &curTime);
last = (INT32)((curTime.tv_sec - startTime.tv_sec) * OS_SYS_MS_PER_SECOND + last = (INT32)((curTime.tv_sec - startTime.tv_sec) * OS_SYS_MS_PER_SECOND +
(curTime.tv_nsec - startTime.tv_nsec) / (OS_SYS_NS_PER_SECOND / OS_SYS_MS_PER_SECOND)); (curTime.tv_nsec - startTime.tv_nsec) / (OS_SYS_NS_PER_SECOND / OS_SYS_MS_PER_SECOND));

View File

@ -42,12 +42,6 @@
#include "los_event.h" #include "los_event.h"
#include "los_mux.h" #include "los_mux.h"
typedef struct {
volatile INT32 *realValue;
INT32 value;
UINT32 clearEvent;
} EventCond;
#define INLINE inline #define INLINE inline
#define BROADCAST_EVENT 1 #define BROADCAST_EVENT 1