From cbb52b2f775d41a208822c5482074f028f121fa5 Mon Sep 17 00:00:00 2001 From: zhang Date: Wed, 23 Mar 2022 15:36:53 +0800 Subject: [PATCH] fix: modify the review problem of osal Signed-off-by: zhang --- khdf/liteos/osal/src/osal_firmware.c | 2 +- khdf/liteos/osal/src/osal_thread.c | 6 +++--- khdf/liteos/osal/src/osal_workqueue.c | 2 +- khdf/liteos_m/osal/src/osal_thread.c | 6 +++--- uhdf2/hdi/test/reg_pnp_device/hdf_dev_reg_pnp_test.c | 4 ++-- .../hdi/test/reg_virtual_device/hdf_dev_reg_virtual_test.c | 2 +- uhdf2/manager/src/devmgr_query_device.c | 4 ++-- uhdf2/manager/src/devmgr_service_stub.c | 2 +- uhdf2/osal/src/osal_sysevent.c | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/khdf/liteos/osal/src/osal_firmware.c b/khdf/liteos/osal/src/osal_firmware.c index 9b578fa..b7a3d55 100644 --- a/khdf/liteos/osal/src/osal_firmware.c +++ b/khdf/liteos/osal/src/osal_firmware.c @@ -127,7 +127,7 @@ int32_t OsalReadFirmware(struct OsalFirmware *fwPara, struct OsalFwBlock *block) } fw = (struct OsalFwDesc *)fwPara->para; - if (fw->openFlag == false) { + if (!fw->openFlag) { HDF_LOGE("%s file do not open", __func__); return HDF_ERR_INVALID_PARAM; } diff --git a/khdf/liteos/osal/src/osal_thread.c b/khdf/liteos/osal/src/osal_thread.c index 7897c58..b3e37f4 100644 --- a/khdf/liteos/osal/src/osal_thread.c +++ b/khdf/liteos/osal/src/osal_thread.c @@ -174,7 +174,7 @@ int32_t OsalThreadSuspend(struct OsalThread *thread) bool flag = false; flag = OsalCheckPara(thread); - if (flag == false) { + if (!flag) { HDF_LOGE("%s invalid parameter %d\n", __func__, __LINE__); return HDF_ERR_INVALID_PARAM; } @@ -193,7 +193,7 @@ int32_t OsalThreadDestroy(struct OsalThread *thread) bool flag = false; flag = OsalCheckPara(thread); - if (flag == false) { + if (!flag) { HDF_LOGE("%s invalid parameter %d\n", __func__, __LINE__); return HDF_ERR_INVALID_PARAM; } @@ -210,7 +210,7 @@ int32_t OsalThreadResume(struct OsalThread *thread) bool flag = false; flag = OsalCheckPara(thread); - if (flag == false) { + if (!flag) { HDF_LOGE("%s invalid parameter %d\n", __func__, __LINE__); return HDF_ERR_INVALID_PARAM; } diff --git a/khdf/liteos/osal/src/osal_workqueue.c b/khdf/liteos/osal/src/osal_workqueue.c index e39c23c..22348b0 100644 --- a/khdf/liteos/osal/src/osal_workqueue.c +++ b/khdf/liteos/osal/src/osal_workqueue.c @@ -170,7 +170,7 @@ bool HdfAddWork(HdfWorkQueue *queue, HdfWork *work) return queue_work(queue->realWorkQueue, &((struct WorkWrapper *)work->realWork)->work.work); } -bool HdfAddDelayedWork(HdfWorkQueue *queue, HdfWork *work, unsigned long ms) +bool HdfAddDelayedWork(HdfWorkQueue *queue, HdfWork *work, uint32_t ms) { if (queue == NULL || queue->realWorkQueue == NULL || work == NULL || work->realWork == NULL) { HDF_LOGE("%s invalid para", __func__); diff --git a/khdf/liteos_m/osal/src/osal_thread.c b/khdf/liteos_m/osal/src/osal_thread.c index af025da..d84b29f 100644 --- a/khdf/liteos_m/osal/src/osal_thread.c +++ b/khdf/liteos_m/osal/src/osal_thread.c @@ -167,7 +167,7 @@ int32_t OsalThreadSuspend(struct OsalThread *thread) bool flag = false; flag = OsalCheckPara(thread); - if (flag == false) { + if (!flag) { HDF_LOGE("%s invalid parameter %d", __func__, __LINE__); return HDF_ERR_INVALID_PARAM; } @@ -186,7 +186,7 @@ int32_t OsalThreadDestroy(struct OsalThread *thread) bool flag = false; flag = OsalCheckPara(thread); - if (flag == false) { + if (!flag) { HDF_LOGE("%s invalid parameter %d", __func__, __LINE__); return HDF_ERR_INVALID_PARAM; } @@ -203,7 +203,7 @@ int32_t OsalThreadResume(struct OsalThread *thread) bool flag = false; flag = OsalCheckPara(thread); - if (flag == false) { + if (!flag) { HDF_LOGE("%s invalid parameter %d", __func__, __LINE__); return HDF_ERR_INVALID_PARAM; } diff --git a/uhdf2/hdi/test/reg_pnp_device/hdf_dev_reg_pnp_test.c b/uhdf2/hdi/test/reg_pnp_device/hdf_dev_reg_pnp_test.c index e8dcac0..bf486f0 100644 --- a/uhdf2/hdi/test/reg_pnp_device/hdf_dev_reg_pnp_test.c +++ b/uhdf2/hdi/test/reg_pnp_device/hdf_dev_reg_pnp_test.c @@ -202,7 +202,7 @@ static void HdfRegPnpDriverTest_005() struct HdfRemoteService *remote = HdfRemoteServiceGet("pnp_driver_service_1"); UT_TEST_CHECK_RET(remote == NULL); if (ret == HDF_SUCCESS) { - HdfUnRegPnpDevice("libpnp_driver1.so", "pnp_driver_service1"); + (void)HdfUnRegPnpDevice("libpnp_driver1.so", "pnp_driver_service1"); } } @@ -230,7 +230,7 @@ static void HdfRegPnpDriverTest_006() uint64_t timeAfter = OsalGetSysTimeMs(); totalTime += timeAfter - timeBefor; } - printf("total time is %ld \n", totalTime); + printf("total time is %lu \n", totalTime); UT_TEST_CHECK_RET((totalTime / 1000) < 20); } diff --git a/uhdf2/hdi/test/reg_virtual_device/hdf_dev_reg_virtual_test.c b/uhdf2/hdi/test/reg_virtual_device/hdf_dev_reg_virtual_test.c index a7b00ec..c6b08eb 100644 --- a/uhdf2/hdi/test/reg_virtual_device/hdf_dev_reg_virtual_test.c +++ b/uhdf2/hdi/test/reg_virtual_device/hdf_dev_reg_virtual_test.c @@ -77,7 +77,7 @@ void PrintTestResult() static void CalcAverageTime(int index, bool type, const OsalTimespec *diff, const char *func, int line) { - if (type == true) { + if (type) { HDF_LOGD("[HDF_TEST] %{public}s line:%{public}d test 1 time use time:%{public}lu s %{public}lu us", func, line, diff->sec, diff->usec); printf("[HDF_TEST] %s line:%d test 1 time use time:%lu s %lu us\r\n", func, line, diff->sec, diff->usec); diff --git a/uhdf2/manager/src/devmgr_query_device.c b/uhdf2/manager/src/devmgr_query_device.c index eaf3a8f..7231d23 100644 --- a/uhdf2/manager/src/devmgr_query_device.c +++ b/uhdf2/manager/src/devmgr_query_device.c @@ -52,12 +52,12 @@ int DevFillQueryDeviceInfo(struct IDevmgrService *inst, struct HdfSBuf *data, st if ((deviceInfo->policy == SERVICE_POLICY_CAPACITY || deviceInfo->policy == SERVICE_POLICY_PUBLIC) && deviceInfo->status == status) { flag = HdfSbufWriteString(reply, deviceInfo->svcName); - if (flag == false) { + if (!flag) { HDF_LOGE("%{public}s writing string failed %{public}s", __func__, deviceInfo->svcName); return HDF_FAILURE; } flag = HdfSbufWriteInt32(reply, deviceInfo->deviceType); - if (flag == false) { + if (!flag) { HDF_LOGE("%{public}s writing int32 failed %{public}d", __func__, deviceInfo->deviceType); return HDF_FAILURE; } diff --git a/uhdf2/manager/src/devmgr_service_stub.c b/uhdf2/manager/src/devmgr_service_stub.c index 38abb5b..25f8ed2 100644 --- a/uhdf2/manager/src/devmgr_service_stub.c +++ b/uhdf2/manager/src/devmgr_service_stub.c @@ -264,7 +264,7 @@ int DevmgrServiceStubStartService(struct IDevmgrService *inst) } fullService->remote = remoteService; - DriverModuleLoadHelperInit(); + (void)DriverModuleLoadHelperInit(); return DevmgrServiceStartService((struct IDevmgrService *)&fullService->super); } diff --git a/uhdf2/osal/src/osal_sysevent.c b/uhdf2/osal/src/osal_sysevent.c index 74e2555..9b9d0d8 100644 --- a/uhdf2/osal/src/osal_sysevent.c +++ b/uhdf2/osal/src/osal_sysevent.c @@ -115,7 +115,7 @@ static int OnKEventReceived( } if (receivedEvent->syncToken != 0) { - FinishEvent(service, receivedEvent); + (void)FinishEvent(service, receivedEvent); } OsalMutexUnlock(¬ifier->mutex);