diff --git a/uhdf2/hdi/test/hdi_sample/sample_client_cpp/sample_client_cpp_test.cpp b/uhdf2/hdi/test/hdi_sample/sample_client_cpp/sample_client_cpp_test.cpp index 06d01fa7dbbd0120377a5df9e0aa8bd8891656ea..7918135c29ac3ab4ac3128484617f50026303af5 100644 --- a/uhdf2/hdi/test/hdi_sample/sample_client_cpp/sample_client_cpp_test.cpp +++ b/uhdf2/hdi/test/hdi_sample/sample_client_cpp/sample_client_cpp_test.cpp @@ -74,7 +74,7 @@ HWTEST_F(SampleHdiCppTest, HdiCppTest001, TestSize.Level1) // passthrough mode get interface object HWTEST_F(SampleHdiCppTest, HdiCppTest002, TestSize.Level1) { - OHOS::sptr sampleService = ISample::Get(TEST_SERVICE_NAME, true); + OHOS::sptr sampleService = ISample::Get(true); ASSERT_TRUE(sampleService != nullptr); OHOS::sptr fooInterface = nullptr; int ret = sampleService->GetInterface(fooInterface); diff --git a/uhdf2/hdi/test/hdi_sample/sample_service_cpp/sample_service_stub.cpp b/uhdf2/hdi/test/hdi_sample/sample_service_cpp/sample_service_stub.cpp index 25caedd632f478e81fedcd11f8d6974e1909e8a1..3905fc9f77e725f6d33134288124ed3155cd40b8 100644 --- a/uhdf2/hdi/test/hdi_sample/sample_service_cpp/sample_service_stub.cpp +++ b/uhdf2/hdi/test/hdi_sample/sample_service_cpp/sample_service_stub.cpp @@ -48,7 +48,8 @@ sptr ISample::Get(const std::string &serviceName, bool isStub) sptr ISample::Get(bool isStub) { - return ISample::Get("sample_service", isStub); + std::string defaultName = "sample_service"; + return ISample::Get(defaultName, isStub); } SampleServiceStub::SampleServiceStub(const sptr &serviceImpl) : diff --git a/uhdf2/host/src/hdf_device_thread.c b/uhdf2/host/src/hdf_device_thread.c index 9bb01a65015993ef480cdf4e2146dbe629690a8f..44514aeb52bf86dedd20a92e93510ccf9e968d83 100644 --- a/uhdf2/host/src/hdf_device_thread.c +++ b/uhdf2/host/src/hdf_device_thread.c @@ -49,7 +49,7 @@ int32_t DeviceThreadMessageHandler(struct HdfMessageTask *task, struct HdfMessag int DeviceThreadAttach(struct DeviceThread *inst, struct IHdfDevice *device, struct HdfDeviceNode *service) { - if (inst != NULL || device == NULL || service == NULL) { + if (inst == NULL || device == NULL || service == NULL) { return HDF_ERR_INVALID_PARAM; }