diff --git a/core/adapter/syscall/src/hdf_devmgr_adapter.c b/core/adapter/syscall/src/hdf_devmgr_adapter.c index cb89be9d..8e83f6bb 100644 --- a/core/adapter/syscall/src/hdf_devmgr_adapter.c +++ b/core/adapter/syscall/src/hdf_devmgr_adapter.c @@ -27,18 +27,18 @@ int32_t HdfLoadDriverByServiceName(const char *serviceName) if (data == NULL) { HDF_LOGE("failed to obtain sbuf data"); ret = HDF_DEV_ERR_NO_MEMORY; - goto out; + goto OUT; } if (!HdfSbufWriteString(data, serviceName)) { HDF_LOGE("failed to write sbuf"); ret = HDF_FAILURE; - goto out; + goto OUT; } ret = ioService->dispatcher->Dispatch(&ioService->object, DEVMGR_LOAD_SERVICE, data, NULL); if (ret != HDF_SUCCESS) { HDF_LOGE("failed to load khdf driver %s", serviceName); } -out: +OUT: HdfIoServiceRecycle(ioService); HdfSbufRecycle(data); return ret; @@ -61,18 +61,18 @@ int32_t HdfGetServiceNameByDeviceClass(DeviceClass deviceClass, struct HdfSBuf * if (data == NULL) { HDF_LOGE("failed to obtain sbuf data"); ret = HDF_DEV_ERR_NO_MEMORY; - goto out; + goto OUT; } if (!HdfSbufWriteInt32(data, deviceClass)) { HDF_LOGE("failed to write sbuf"); ret = HDF_FAILURE; - goto out; + goto OUT; } ret = ioService->dispatcher->Dispatch(&ioService->object, DEVMGR_GET_SERVICE, data, reply); if (ret != HDF_SUCCESS) { HDF_LOGE("failed to query service by class"); } -out: +OUT: HdfIoServiceRecycle(ioService); HdfSbufRecycle(data); return ret; diff --git a/core/adapter/syscall/src/hdf_syscall_adapter.c b/core/adapter/syscall/src/hdf_syscall_adapter.c index 686a9a49..d119eb71 100644 --- a/core/adapter/syscall/src/hdf_syscall_adapter.c +++ b/core/adapter/syscall/src/hdf_syscall_adapter.c @@ -148,7 +148,7 @@ static int32_t HdfDevEventReadAndDispatch(struct HdfDevListenerThread *thread, i if (adapter == NULL) { HDF_LOGI("%s: invalid adapter", __func__); OsalMSleep(1); // yield to sync adapter list - goto finish; + goto FINISH; } while (true) { @@ -170,12 +170,12 @@ static int32_t HdfDevEventReadAndDispatch(struct HdfDevListenerThread *thread, i HDF_LOGE("%s:ioctl failed, errno=%d", __func__, ret); } - goto finish; + goto FINISH; } ret = HdfDevEventDispatchLocked(thread, adapter, &bwr); -finish: +FINISH: OsalMemFree((void *)(uintptr_t)bwr.readBuffer); OsalMutexUnlock(&thread->mutex); return ret; @@ -228,7 +228,7 @@ static int32_t HdfDevEventListenTask(void *para) pollCount = AssignPfds(thread, &pfds, &pfdSize); } if (pollCount <= 0) { - goto exit; + goto EXIT; } int32_t pollSize = poll(pfds, pollCount, -1); if (pollSize <= 0) { @@ -242,17 +242,17 @@ static int32_t HdfDevEventListenTask(void *para) } if ((((uint32_t)pfds[i].revents) & POLLIN) && HdfDevEventReadAndDispatch(thread, pfds[i].fd) != HDF_SUCCESS) { - goto exit; + goto EXIT; } else if (((uint32_t)pfds[i].revents) & POLLHUP) { HDF_LOGI("event listener task received exit event"); - goto exit; + goto EXIT; } else if (((uint32_t)pfds[i].revents) & POLLNVAL) { OsalMSleep(1); // polled closed fd, yield to sync } } } -exit: +EXIT: HDF_LOGI("event listener task exit"); thread->status = LISTENER_EXITED; @@ -713,30 +713,30 @@ struct HdfIoService *HdfIoServiceAdapterObtain(const char *serviceName) realPath = OsalMemCalloc(PATH_MAX); if (devNodePath == NULL || realPath == NULL) { HDF_LOGE("%s: out of memory", __func__); - goto out; + goto OUT; } if (sprintf_s(devNodePath, PATH_MAX - 1, "%s%s", devPath, serviceName) < 0) { HDF_LOGE("Failed to get the node path"); - goto out; + goto OUT; } if (realpath(devNodePath, realPath) == NULL && TrytoLoadIoService(serviceName, devNodePath, realPath) != HDF_SUCCESS) { - goto out; + goto OUT; } adapter = (struct HdfSyscallAdapter *)OsalMemCalloc(sizeof(struct HdfSyscallAdapter)); if (adapter == NULL) { HDF_LOGE("Failed to allocate SyscallAdapter"); - goto out; + goto OUT; } DListHeadInit(&adapter->listenerList); if (OsalMutexInit(&adapter->mutex)) { HDF_LOGE("%s: Failed to create mutex", __func__); OsalMemFree(adapter); - goto out; + goto OUT; } adapter->fd = open(realPath, O_RDWR); @@ -744,14 +744,14 @@ struct HdfIoService *HdfIoServiceAdapterObtain(const char *serviceName) HDF_LOGE("Open file node %{public}s failed, (%d)%{public}s", realPath, errno, strerror(errno)); OsalMutexDestroy(&adapter->mutex); OsalMemFree(adapter); - goto out; + goto OUT; } ioService = &adapter->super; static struct HdfIoDispatcher dispatch = { .Dispatch = HdfSyscallAdapterDispatch, }; ioService->dispatcher = &dispatch; -out: +OUT: OsalMemFree(devNodePath); OsalMemFree(realPath); return ioService; @@ -938,7 +938,7 @@ int32_t HdfIoServiceGroupRegisterListener(struct HdfIoServiceGroup *group, struc if (it == listener) { HDF_LOGE("Failed to add group listener, repeated registration"); ret = HDF_ERR_INVALID_PARAM; - goto finish; + goto FINISH; } } DListInsertTail(&listener->listNode, &adapterGroup->listenerList); @@ -949,7 +949,7 @@ int32_t HdfIoServiceGroupRegisterListener(struct HdfIoServiceGroup *group, struc } } -finish: +FINISH: OsalMutexUnlock(&listenerThread->mutex); OsalMutexUnlock(&adapterGroup->mutex); return ret; diff --git a/core/host/src/devhost_service.c b/core/host/src/devhost_service.c index 7c7c0e80..eea2ca8a 100644 --- a/core/host/src/devhost_service.c +++ b/core/host/src/devhost_service.c @@ -84,7 +84,7 @@ int DevHostServiceAddDevice(struct IDevHostService *inst, const struct HdfDevice driver = driverLoader->GetDriver(deviceInfo->moduleName); if (driver == NULL) { ret = HDF_DEV_ERR_NODATA; - goto error; + goto ERROR; } devNode = HdfDeviceNodeNewInstance(deviceInfo, driver); @@ -99,11 +99,11 @@ int DevHostServiceAddDevice(struct IDevHostService *inst, const struct HdfDevice ret = device->super.Attach(&device->super, devNode); if (ret != HDF_SUCCESS) { HdfDeviceNodeFreeInstance(devNode); - goto error; + goto ERROR; } return HDF_SUCCESS; -error: +ERROR: if (DListIsEmpty(&device->devNodes)) { DevHostServiceFreeDevice(hostService, device); } diff --git a/tools/hdi-gen/test/c_test/data_test/v1_0/c_data_test.cpp b/tools/hdi-gen/test/c_test/data_test/v1_0/c_data_test.cpp index 5bc696ca..c974efde 100644 --- a/tools/hdi-gen/test/c_test/data_test/v1_0/c_data_test.cpp +++ b/tools/hdi-gen/test/c_test/data_test/v1_0/c_data_test.cpp @@ -208,13 +208,13 @@ HWTEST_F(CDataTest, CDataTest_014, TestSize.Level1) ssize_t readSize = read(fd, recvMsg, sizeof(recvMsg)); if (readSize < 0) { printf("read failed\n"); - goto finished; + goto FINISHED; } else { printf("read size:%d\n", readSize); } printf("recvMsg:%s", recvMsg); -finished: +FINISHED: close(fd); } diff --git a/tools/hdi-gen/util/string.cpp b/tools/hdi-gen/util/string.cpp index 7d360f4d..ae241272 100644 --- a/tools/hdi-gen/util/string.cpp +++ b/tools/hdi-gen/util/string.cpp @@ -711,22 +711,22 @@ String& String::operator+=(const char* other) String newString(newSize); if (newString.string_ == nullptr) { Logger::E(String::TAG, "The operator+= of \"%s\" is failed.", string_); - goto finished; + goto FINISHED; } if (string_ != nullptr && thisSize > 0) { if (memcpy_s(newString.string_, newSize + 1, string_, thisSize) != EOK) { Logger::E(String::TAG, "The operator+= of \"%s\" is failed. 2", string_); - goto finished; + goto FINISHED; } } if (strcpy_s(newString.string_ + thisSize, newSize + 1 - thisSize, other) != EOK) { Logger::E(String::TAG, "The operator+= of \"%s\" is failed.", string_); - goto finished; + goto FINISHED; } -finished: +FINISHED: SharedData::Release(string_); SharedData::AddRef(newString.string_); string_ = newString.string_; @@ -744,22 +744,22 @@ String& String::operator+=(const String& other) String newString(newSize); if (newString.string_ == nullptr) { Logger::E(String::TAG, "The operator+= of \"%s\" is failed. 1", string_); - goto finished; + goto FINISHED; } if (string_ != nullptr && thisSize > 0) { if (memcpy_s(newString.string_, newSize + 1, string_, thisSize) != EOK) { Logger::E(String::TAG, "The operator+= of \"%s\" is failed. 2", string_); - goto finished; + goto FINISHED; } } if (strcpy_s(newString.string_ + thisSize, newSize + 1 - thisSize, other.string_) != EOK) { Logger::E(String::TAG, "The operator+= of \"%s\" is failed. 3", string_); - goto finished; + goto FINISHED; } -finished: +FINISHED: SharedData::Release(string_); SharedData::AddRef(newString.string_); string_ = newString.string_; diff --git a/utils/src/hdf_ordered_list.c b/utils/src/hdf_ordered_list.c index 3f45ac33..8deff238 100644 --- a/utils/src/hdf_ordered_list.c +++ b/utils/src/hdf_ordered_list.c @@ -37,7 +37,7 @@ void HdfOrderedListOffer(struct HdfOrderedList *list, struct HdfOrderedListEntit OsalMutexLock(&list->mutex); if (HdfSListIsEmpty(&list->head)) { HdfSListAdd(&list->head, &newEntity->node); - goto finished; + goto FINISHED; } HdfSListIteratorInit(&it, &list->head); while (HdfSListIteratorHasNext(&it)) { @@ -47,7 +47,7 @@ void HdfOrderedListOffer(struct HdfOrderedList *list, struct HdfOrderedListEntit break; } } -finished: +FINISHED: OsalMutexUnlock(&list->mutex); OsalSemPost(&list->sem); } diff --git a/utils/src/osal_msg_queue.c b/utils/src/osal_msg_queue.c index 5f67f64a..cd72c8c0 100644 --- a/utils/src/osal_msg_queue.c +++ b/utils/src/osal_msg_queue.c @@ -44,12 +44,12 @@ void HdfMessageQueueEnqueue( struct HdfMessage *next = (struct HdfMessage *)HdfSListIteratorNext(&it); if (next->timeStamp > message->timeStamp) { HdfSListIteratorInsert(&it, &message->entry); - goto complete; + goto COMPLETE; } } HdfSListAddTail(&queue->list, &message->entry); -complete: +COMPLETE: OsalMutexUnlock(&queue->mutex); OsalSemPost(&queue->semaphore); }