From 43baa4fdc44d974d1ed93fef2c0ff6ce423cc002 Mon Sep 17 00:00:00 2001 From: wangchen <253227059@qq.com> Date: Tue, 8 Mar 2022 08:36:59 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=86=85=E6=BA=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A3=80=E8=A7=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【背景】内源代码检视问题 【修改方案】 1,按检视意见,进行资源泄露等问题的修改 【影响】 对现有的产品编译不会有影响。 re #I4WV56 Signed-off-by: wangchen --- arch/risc-v/nuclei/gcc/los_exc.S | 1 - components/fs/littlefs/lfs_api.c | 34 +++++++++---------- components/lms/los_lms.c | 5 +-- .../net/lwip-2.1/porting/src/api_shell.c | 2 ++ kal/cmsis/cmsis_liteos2.c | 2 +- .../Common/Source/GCC/intexc_demosoc.S | 1 - .../demosoc/Common/Source/system_demosoc.c | 16 ++------- .../Common/Source/Drivers/Usb/drv_usbd_int.c | 33 +++++++++--------- .../Common/Source/GCC/intexc_gd32vf103.S | 1 - .../Common/Source/system_gd32vf103.c | 18 ++-------- testsuites/sample/kernel/mem/It_los_mem_006.c | 1 - testsuites/sample/kernel/mem/It_los_mem_046.c | 25 +++++++------- .../src/pthread/pthread_cond_func_test.c | 11 +++--- 13 files changed, 61 insertions(+), 89 deletions(-) diff --git a/arch/risc-v/nuclei/gcc/los_exc.S b/arch/risc-v/nuclei/gcc/los_exc.S index fea0f9ad..5f19277c 100644 --- a/arch/risc-v/nuclei/gcc/los_exc.S +++ b/arch/risc-v/nuclei/gcc/los_exc.S @@ -179,7 +179,6 @@ exc_entry: csrr a0, mcause mv a1, sp /* - * TODO: Call the exception handler function * By default, the function template is provided in * system_Device.c, you can adjust it as you want */ diff --git a/components/fs/littlefs/lfs_api.c b/components/fs/littlefs/lfs_api.c index 5c3e21cb..3e9d930e 100644 --- a/components/fs/littlefs/lfs_api.c +++ b/components/fs/littlefs/lfs_api.c @@ -336,19 +336,19 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType, if (target == NULL || fileSystemType == NULL || data == NULL) { errno = EFAULT; ret = VFS_ERROR; - goto errout; + goto ERROUT; } if (strcmp(fileSystemType, "littlefs") != 0) { errno = ENODEV; ret = VFS_ERROR; - goto errout; + goto ERROUT; } if (CheckPathIsMounted(target, &fileOpInfo)) { errno = EBUSY; ret = VFS_ERROR; - goto errout; + goto ERROUT; } // select free mount resource @@ -356,7 +356,7 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType, if (fileOpInfo == NULL) { errno = ENODEV; ret = VFS_ERROR; - goto errout; + goto ERROUT; } ret = lfs_mount(&(fileOpInfo->lfsInfo), (struct lfs_config*)data); @@ -372,7 +372,7 @@ int LfsMount(const char *source, const char *target, const char *fileSystemType, ret = VFS_ERROR; } -errout: +ERROUT: return ret; } @@ -483,23 +483,23 @@ DIR *LfsOpendir(const char *dirName) if (dirName == NULL) { errno = EFAULT; - goto errout; + goto ERROUT; } if (CheckPathIsMounted(dirName, &fileOpInfo) == FALSE || fileOpInfo == NULL) { errno = ENOENT; - goto errout; + goto ERROUT; } if (CheckDirIsOpen(dirName)) { errno = EBUSY; - goto errout; + goto ERROUT; } FileDirInfo *dirInfo = GetFreeDir(dirName); if (dirInfo == NULL) { errno = ENFILE; - goto errout; + goto ERROUT; } ret = lfs_dir_open(&(fileOpInfo->lfsInfo), (lfs_dir_t *)(&(dirInfo->dir)), dirName); @@ -507,14 +507,14 @@ DIR *LfsOpendir(const char *dirName) if (ret != 0) { FreeDirInfo(dirName); errno = LittlefsErrno(ret); - goto errout; + goto ERROUT; } dirInfo->lfsHandle = &(fileOpInfo->lfsInfo); return (DIR *)dirInfo; -errout: +ERROUT: return NULL; } @@ -584,23 +584,23 @@ int LfsOpen(const char *pathName, int openFlag, ...) if (pathName == NULL) { errno = EFAULT; - goto errout; + goto ERROUT; } if (CheckPathIsMounted(pathName, &fileOpInfo) == FALSE || fileOpInfo == NULL) { errno = ENOENT; - goto errout; + goto ERROUT; } // if file is already open, return invalid fd if (CheckFileIsOpen(pathName)) { errno = EBUSY; - goto errout; + goto ERROUT; } LittleFsHandleStruct *fsHandle = LfsAllocFd(pathName, &fd); if (fd == INVALID_FD) { errno = ENFILE; - goto errout; + goto ERROUT; } int lfsOpenFlag = ConvertFlagToLfsOpenFlag(openFlag); @@ -608,13 +608,13 @@ int LfsOpen(const char *pathName, int openFlag, ...) if (err != 0) { LfsFreeFd(fd); errno = LittlefsErrno(err); - goto errout; + goto ERROUT; } g_handle[fd].lfsHandle = &(fileOpInfo->lfsInfo); return fd; -errout: +ERROUT: return INVALID_FD; } diff --git a/components/lms/los_lms.c b/components/lms/los_lms.c index be43c415..8886305b 100755 --- a/components/lms/los_lms.c +++ b/components/lms/los_lms.c @@ -182,11 +182,12 @@ VOID LOS_LmsCheckPoolDel(const VOID *pool) LmsMemListNode *delNode = OsLmsGetPoolNode(pool); if (delNode == NULL) { PRINT_ERR("[LMS]pool %p is not on lms checklist !\n", pool); - goto Release; + goto REALEASE; } delNode->used = LMS_POOL_UNUSED; LOS_ListDelete(&(delNode->node)); -Release: + +REALEASE: LMS_UNLOCK(intSave); } diff --git a/components/net/lwip-2.1/porting/src/api_shell.c b/components/net/lwip-2.1/porting/src/api_shell.c index 959db672..161b237d 100644 --- a/components/net/lwip-2.1/porting/src/api_shell.c +++ b/components/net/lwip-2.1/porting/src/api_shell.c @@ -605,6 +605,8 @@ u32_t OsShellPing(int argc, const char **argv) PRINTK("Ping cmd failed due some errors\n"); } + free(parg); + return LOS_OK; ping_error: lwip_ping_usage(); diff --git a/kal/cmsis/cmsis_liteos2.c b/kal/cmsis/cmsis_liteos2.c index dc8a529e..0be444f7 100644 --- a/kal/cmsis/cmsis_liteos2.c +++ b/kal/cmsis/cmsis_liteos2.c @@ -1634,7 +1634,7 @@ uint32_t osMemoryPoolGetSpace(osMemoryPoolId_t mp_id) if ((mp->status & MEM_POOL_VALID) != MEM_POOL_VALID) { space = 0; } else { - space = mp->poolInfo.uwBlkCnt - mp->poolInfo.uwBlkCnt; + space = mp->poolInfo.uwBlkNum - mp->poolInfo.uwBlkCnt; } LOS_IntRestore(intSave); diff --git a/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/GCC/intexc_demosoc.S b/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/GCC/intexc_demosoc.S index a449f14c..1fc0ced9 100644 --- a/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/GCC/intexc_demosoc.S +++ b/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/GCC/intexc_demosoc.S @@ -169,7 +169,6 @@ exc_entry: csrr a0, mcause mv a1, sp /* - * TODO: Call the exception handler function * By default, the function template is provided in * system_Device.c, you can adjust it as you want */ diff --git a/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/system_demosoc.c b/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/system_demosoc.c index c8bd1def..9a3a5cef 100644 --- a/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/system_demosoc.c +++ b/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Source/system_demosoc.c @@ -30,8 +30,6 @@ /*---------------------------------------------------------------------------- Define clocks *----------------------------------------------------------------------------*/ -/* ToDo: add here your necessary defines for device initialization - following is an example for different system frequencies */ #ifndef SYSTEM_CLOCK #define SYSTEM_CLOCK (80000000UL) #endif @@ -71,9 +69,6 @@ /*---------------------------------------------------------------------------- System Core Clock Variable *----------------------------------------------------------------------------*/ -/* ToDo: initialize SystemCoreClock with the system core clock frequency value - achieved after system intitialization. - This means system core clock frequency after call to SystemInit() */ /** * \brief Variable to hold the system core clock value * \details @@ -101,9 +96,7 @@ uint32_t SystemCoreClock = SYSTEM_CLOCK; /* System Clock Frequency (Core Clock) */ void SystemCoreClockUpdate(void) /* Get Core Clock Frequency */ { - /* ToDo: add code to calculate the system frequency based upon the current - * register settings. - * Note: This function can be used to retrieve the system core clock frequeny + /* Note: This function can be used to retrieve the system core clock frequeny * after user changed register settings. */ SystemCoreClock = SYSTEM_CLOCK; @@ -119,8 +112,7 @@ void SystemCoreClockUpdate(void) /* Get Core Clock Frequency */ */ void SystemInit(void) { - /* ToDo: add code to initialize the system - * Warn: do not use global variables because this function is called before + /* Warn: do not use global variables because this function is called before * reaching pre-main. RW section maybe overwritten afterwards. */ SystemCoreClock = SYSTEM_CLOCK; @@ -164,7 +156,6 @@ typedef void (*EXC_HANDLER)(unsigned long mcause, unsigned long sp); */ static void system_default_exception_handler(unsigned long mcause, unsigned long sp) { - /* TODO: Uncomment this if you have implement printf function */ printf("MCAUSE : 0x%lx\r\n", mcause); printf("MDCAUSE: 0x%lx\r\n", __RV_CSR_READ(CSR_MDCAUSE)); printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC)); @@ -276,7 +267,6 @@ void SystemBannerPrint(void) void ECLIC_Init(void) { /* Global Configuration about MTH and NLBits. - * TODO: Please adapt it according to your system requirement. * This function is called in _init function */ ECLIC_SetMth(0); ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS); @@ -333,7 +323,6 @@ int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_ */ void _premain_init(void) { - /* TODO: Add your own initialization code here, called before main */ /* __ICACHE_PRESENT and __DCACHE_PRESENT are defined in demosoc.h */ #if defined(__ICACHE_PRESENT) && __ICACHE_PRESENT == 1 EnableICache(); @@ -363,7 +352,6 @@ void _premain_init(void) */ void _postmain_fini(int status) { - /* TODO: Add your own finishing code here, called after main */ #ifdef SIMULATION_XLSPIKE extern void xlspike_exit(int status); xlspike_exit(status); diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/Drivers/Usb/drv_usbd_int.c b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/Drivers/Usb/drv_usbd_int.c index 14d2d1e3..7bf1ac0e 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/Drivers/Usb/drv_usbd_int.c +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/Drivers/Usb/drv_usbd_int.c @@ -8,27 +8,27 @@ /* Copyright (c) 2019, GigaDevice Semiconductor Inc. - Redistribution and use in source and binary forms, with or without modification, + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, this + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "gd32vf103_libopt.h" @@ -80,7 +80,6 @@ uint32_t USBD_OTG_EP1OUT_ISR_Handler (usb_core_driver *udev) { oeplen = udev->regs.er_out[1]->DOEPLEN; - /* ToDo : handle more than one single MPS size packet */ udev->dev.transc_out[1].xfer_count = udev->dev.transc_out[1].usb_transc - \ oeplen & DEPLEN_TLEN; } @@ -182,7 +181,7 @@ void usbd_isr (usb_core_driver *udev) /* start of frame interrupt */ if (intr & GINTF_SOF) { if (udev->dev.class_core->SOF) { - udev->dev.class_core->SOF(udev); + udev->dev.class_core->SOF(udev); } if (0U != setupc_flag) { diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/GCC/intexc_gd32vf103.S b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/GCC/intexc_gd32vf103.S index 9298f554..b7bfd553 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/GCC/intexc_gd32vf103.S +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/GCC/intexc_gd32vf103.S @@ -169,7 +169,6 @@ exc_entry: csrr a0, mcause mv a1, sp /* - * TODO: Call the exception handler function * By default, the function template is provided in * system_Device.c, you can adjust it as you want */ diff --git a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/system_gd32vf103.c b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/system_gd32vf103.c index 3ed8d65d..b8f0220a 100644 --- a/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/system_gd32vf103.c +++ b/targets/riscv_nuclei_gd32vf103_soc_gcc/SoC/gd32vf103/Common/Source/system_gd32vf103.c @@ -31,8 +31,6 @@ /*---------------------------------------------------------------------------- Define clocks *----------------------------------------------------------------------------*/ -/* ToDo: add here your necessary defines for device initialization - following is an example for different system frequencies */ #ifndef SYSTEM_CLOCK #define SYSTEM_CLOCK __SYSTEM_CLOCK_108M_PLL_HXTAL #endif @@ -66,9 +64,6 @@ /*---------------------------------------------------------------------------- System Core Clock Variable *----------------------------------------------------------------------------*/ -/* ToDo: initialize SystemCoreClock with the system core clock frequency value - achieved after system intitialization. - This means system core clock frequency after call to SystemInit() */ /** * \brief Variable to hold the system core clock value * \details @@ -200,9 +195,7 @@ static void system_clock_config(void) */ void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */ { - /* ToDo: add code to calculate the system frequency based upon the current - * register settings. - * Note: This function can be used to retrieve the system core clock + /* Note: This function can be used to retrieve the system core clock * frequeny after user changed register settings. */ uint32_t scss; @@ -288,8 +281,7 @@ void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */ */ void SystemInit (void) { - /* ToDo: add code to initialize the system - * Warn: do not use global variables because this function is called before + /* Warn: do not use global variables because this function is called before * reaching pre-main. RW section maybe overwritten afterwards. */ /* reset the RCC clock configuration to the default reset state */ @@ -359,7 +351,6 @@ typedef void (*EXC_HANDLER) (unsigned long mcause, unsigned long sp); */ static void system_default_exception_handler(unsigned long mcause, unsigned long sp) { - /* TODO: Uncomment this if you have implement printf function */ printf("MCAUSE: 0x%lx\r\n", mcause); printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC)); printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MBADADDR)); @@ -435,7 +426,7 @@ uint32_t core_exception_handler(unsigned long mcause, unsigned long sp) PRINTK("----------------All Task infomation ------------\r\n"); HalDisplayTaskInfo(); PRINTK("---------------exc handler infomation -----------\r\n"); - + if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) { exc_handler = (EXC_HANDLER)SystemExceptionHandlers[EXCn]; } else if (EXCn == NMI_EXCn) { @@ -471,7 +462,6 @@ void SystemBannerPrint(void) */ void ECLIC_Init(void) { - /* TODO: Add your own initialization code here. This function will be called by main */ ECLIC_SetMth(0); ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS); } @@ -527,7 +517,6 @@ int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_ */ void _premain_init(void) { - /* TODO: Add your own initialization code here, called before main */ SystemCoreClock = get_cpu_freq(); /* configure USART */ gd_com_init(SOC_DEBUG_UART); @@ -550,7 +539,6 @@ void _premain_init(void) */ void _postmain_fini(int status) { - /* TODO: Add your own finishing code here, called after main */ } /** diff --git a/testsuites/sample/kernel/mem/It_los_mem_006.c b/testsuites/sample/kernel/mem/It_los_mem_006.c index 07b722ea..2ef753f5 100644 --- a/testsuites/sample/kernel/mem/It_los_mem_006.c +++ b/testsuites/sample/kernel/mem/It_los_mem_006.c @@ -52,7 +52,6 @@ static UINT32 TestCase(VOID) ICUNIT_GOTO_EQUAL(1, 0, 0, EXIT); } - size = size; p0 = LOS_MemAlloc(g_memPool, size); ICUNIT_GOTO_EQUAL(p0, NULL, p0, EXIT); diff --git a/testsuites/sample/kernel/mem/It_los_mem_046.c b/testsuites/sample/kernel/mem/It_los_mem_046.c index 2a36be9b..6a1bdadc 100644 --- a/testsuites/sample/kernel/mem/It_los_mem_046.c +++ b/testsuites/sample/kernel/mem/It_los_mem_046.c @@ -33,21 +33,23 @@ #include "It_los_mem.h" #if (LOSCFG_MEM_MUL_REGIONS == 1) +#define TC_POOL_SIZE_1 0x200 +#define TC_POOL_SIZE_2 0x400 +#define TC_GAP_SIZE 0x10 // simulate two non-continuous memory regions -STATIC UINT8 g_memPool_TC46_01[0x200]; -STATIC UINT8 g_memGap_TC46[0x10]; -STATIC UINT8 g_memPool_TC46_02[0x400]; +STATIC UINT8 g_memPool_TC46_01[TC_POOL_SIZE_1]; +STATIC UINT8 g_memGap_TC46[TC_GAP_SIZE]; +STATIC UINT8 g_memPool_TC46_02[TC_POOL_SIZE_2]; static UINT32 TestCase(VOID) { UINT32 ret; void *p = NULL; - LosMemRegion memRegions[] = - { - {g_memPool_TC46_01, 0x200}, - {g_memPool_TC46_02, 0x400} - }; + LosMemRegion memRegions[] = { + {g_memPool_TC46_01, TC_POOL_SIZE_1}, + {g_memPool_TC46_02, TC_POOL_SIZE_2} + }; // Initialize the LOS_MemRegionsAdd ret = LOS_MemRegionsAdd(m_aucSysMem0, memRegions, sizeof(memRegions) / sizeof(memRegions[0])); @@ -56,8 +58,8 @@ static UINT32 TestCase(VOID) } // p points to the start address of the gap node between g_memPool_TC46_01 and g_memPool_TC46_02 - p = g_memPool_TC46_01 + 0x200; - (void)memset_s(g_memGap_TC46, 0x10, 1, 0x10); + p = g_memPool_TC46_01 + TC_POOL_SIZE_1; + (void)memset_s(g_memGap_TC46, TC_GAP_SIZE, 1, TC_GAP_SIZE); ret = LOS_MemFree(m_aucSysMem0, p); ICUNIT_GOTO_EQUAL(ret, LOS_NOK, ret, EXIT); @@ -76,6 +78,3 @@ VOID ItLosMem046(void) { TEST_ADD_CASE("ItLosMem046", TestCase, TEST_LOS, TEST_MEM, TEST_LEVEL1, TEST_FUNCTION); } - - - diff --git a/testsuites/unittest/posix/src/pthread/pthread_cond_func_test.c b/testsuites/unittest/posix/src/pthread/pthread_cond_func_test.c index ce08df7e..4d180ead 100644 --- a/testsuites/unittest/posix/src/pthread/pthread_cond_func_test.c +++ b/testsuites/unittest/posix/src/pthread/pthread_cond_func_test.c @@ -680,7 +680,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread009, Function | MediumTest | Lev ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - + for (i = 0; i < TEST_THREAD_COUNT; i++) { ret = pthread_create(&thread[i], &attr, pthread_prio_f01, TEST_THREAD_COUNT - i); ICUNIT_ASSERT_EQUAL(ret, 0, ret); @@ -731,7 +731,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread010, Function | MediumTest | Lev ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - + for (i = 0; i < TEST_THREAD_COUNT; i++) { ret = pthread_once(&onceControl, pthread_once_f01); ICUNIT_ASSERT_EQUAL(ret, 0, ret); @@ -779,7 +779,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread011, Function | MediumTest | Lev ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - + ret = pthread_create(&thread, &attr, pthread_cancel_f01, NULL); ICUNIT_ASSERT_EQUAL(ret, 0, ret); @@ -842,7 +842,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread012, Function | MediumTest | Lev ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - + ret = pthread_create(&thread, &attr, pthread_testcancel_f01, NULL); ICUNIT_ASSERT_EQUAL(ret, 0, ret); @@ -965,8 +965,7 @@ LITE_TEST_CASE(PthreadFuncTestSuite, testPthread016, Function | MediumTest | Lev int ret; pthread_mutexattr_init(&mutex_attr); ret = pthread_mutexattr_settype(NULL, PTHREAD_MUTEX_ERRORCHECK); - if (ret == 0) - { + if (ret == 0) { ICUNIT_ASSERT_EQUAL(ret, 0, ret); } pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK);