diff --git a/apps/shell/src/main.c b/apps/shell/src/main.c index d0ece20c113c1eba9ce73ec6d6c9e8e4929b76ba..791d0dcbc2c45af20984cc62484332c4b3db7cac 100644 --- a/apps/shell/src/main.c +++ b/apps/shell/src/main.c @@ -49,7 +49,7 @@ ShellCB *OsGetShellCb() return g_shellCB; } -void ShellDeinit(ShellCB *shellCB) +static void ShellDeinit(ShellCB *shellCB) { (void)pthread_mutex_destroy(&shellCB->historyMutex); (void)pthread_mutex_destroy(&shellCB->keyMutex); @@ -65,27 +65,23 @@ static int OsShellCreateTask(ShellCB *shellCB) ret = sched_getparam(getpid(), ¶m); if (ret != SH_OK) { - goto OUT; + return ret; } param.sched_priority = SHELL_PROCESS_PRIORITY_INIT; ret = sched_setparam(getpid(), ¶m); if (ret != SH_OK) { - goto OUT; + return ret; } ret = ShellTaskInit(shellCB); if (ret != SH_OK) { - goto OUT; + return ret; } shellCB->shellEntryHandle = pthread_self(); return 0; - -OUT: - ShellDeinit(shellCB); - return ret; } static int DoShellExec(char **argv) @@ -148,7 +144,7 @@ int main(int argc, char **argv) shellCB = (ShellCB *)malloc(sizeof(ShellCB)); if (shellCB == NULL) { - goto ERR_OUT1; + return SH_NOK; } ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB)); if (ret != SH_OK) { @@ -176,7 +172,9 @@ int main(int argc, char **argv) g_shellCB = shellCB; ret = OsShellCreateTask(shellCB); if (ret != SH_OK) { - goto ERR_OUT3; + ShellDeinit(shellCB); + g_shellCB = NULL; + return ret; } ShellEntry(shellCB); diff --git a/drivers/block/disk/src/disk.c b/drivers/block/disk/src/disk.c index 6db419cb0b748df2537626a12bb18fd277007276..60ecf2c28360f2e604bddb05158d5bd3f98a383d 100644 --- a/drivers/block/disk/src/disk.c +++ b/drivers/block/disk/src/disk.c @@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops, ret = VnodeLookup(diskName, &blkDriver, 0); if (ret < 0) { VnodeDrop(); - ret = ENOENT; + PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret); goto DISK_FIND_ERROR; } struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops; diff --git a/kernel/base/vm/los_vm_dump.c b/kernel/base/vm/los_vm_dump.c index 43f62afa04a82eefa4330556efaec69f529df040..f326ea127ef2ac7c0adc192c0087a14087789b4c 100644 --- a/kernel/base/vm/los_vm_dump.c +++ b/kernel/base/vm/los_vm_dump.c @@ -146,7 +146,6 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm) LosVmSpace *space = NULL; LOS_DL_LIST *spaceList = NULL; UINT32 UProcessUsed = 0; - UINT32 pmTmp; if (actualPm == NULL) { return 0; @@ -167,8 +166,7 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm) if (space == LOS_GetKVmSpace()) { continue; } - (VOID)OsUProcessPmUsage(space, NULL, &pmTmp); - UProcessUsed += pmTmp; + UProcessUsed += OsUProcessPmUsage(space, NULL, NULL); } (VOID)LOS_MuxRelease(vmSpaceListMux); diff --git a/kernel/extended/hilog/los_hilog.c b/kernel/extended/hilog/los_hilog.c index 3758f9a2a80f40736cd0bf32dfdc7a79e6c38bf0..8ad4eb27784ef16bea036b72b4a05b43fa716783 100644 --- a/kernel/extended/hilog/los_hilog.c +++ b/kernel/extended/hilog/los_hilog.c @@ -233,14 +233,8 @@ static int HiLogWriteRingBuffer(unsigned char *buffer, size_t bufLen) static void HiLogHeadInit(struct HiLogEntry *header, size_t len) { - struct timespec now; - int ret; - - ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { - PRINTK("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__); - return; - } + struct timespec now = {0}; + (void)clock_gettime(CLOCK_REALTIME, &now); header->len = len; header->pid = LOS_GetCurrProcessID(); diff --git a/net/lwip-2.1/enhancement/src/api_shell.c b/net/lwip-2.1/enhancement/src/api_shell.c index 4d2487cb0926694b2fcd89df44b71e3f54758747..044df9741cae737dbcd647889b55e3c7df9822d3 100644 --- a/net/lwip-2.1/enhancement/src/api_shell.c +++ b/net/lwip-2.1/enhancement/src/api_shell.c @@ -2175,8 +2175,6 @@ u32_t osShellPing6(int argc, const char **argv) /* Setting the start time of the entire ping task for statistics */ (void)clock_gettime(CLOCK_MONOTONIC_RAW, &first); - nsent = 0; - for (nsent = 0; nsent < ping6_params.pingcount; nsent++) { /* capture the start tick to calculate rtt */ (void)clock_gettime(CLOCK_MONOTONIC_RAW, &start); @@ -3170,7 +3168,6 @@ void netstat_internal(void *ctx) } /* For listen PCBs */ - recvQlen = 0; sendQlen = 0; for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { @@ -3670,7 +3667,7 @@ u32_t netdebug_sock(int argc, const char **argv) int idx; u32_t ret = LOS_NOK; - if (argc == 2) { + if (argc == 2) { /* 2: Number of command parameters */ if (!strcmp("-i", argv[1])) { /* netdebug sock -i */ for (idx = 0; idx < (int)LWIP_CONFIG_NUM_SOCKETS; idx++) { @@ -3678,10 +3675,9 @@ u32_t netdebug_sock(int argc, const char **argv) } ret = LOS_OK; } - } else if (argc == 3) { + } else if (argc == 3) { /* 3: Number of command parameters */ if (!strcmp("-d", argv[1])) { - /* netdebug sock -d */ - idx = atoi(argv[2]); + idx = atoi(argv[2]); /* 2: netdebug sock -d */ if (idx >= 0) { debug_socket_info(idx, 1, 1); ret = LOS_OK;