mirror of
https://github.com/openharmony/drivers_adapter.git
synced 2026-07-20 02:34:12 -04:00
fix: clear code warnings of master
Signed-off-by: guodongqi <guodongqi2@huawei.com>
This commit is contained in:
@@ -307,31 +307,31 @@ static int32_t SerStubListTypeTest(struct HdfDeviceIoClient *client, struct HdfS
|
||||
if (!HdfSbufReadInt8(data, (input + i))) {
|
||||
HDF_LOGE("%{public}s: read data size failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
ec = HdiSampleImplInstance()->ArrayTypeTest(client->device, input, inSize, &output, &outSize);
|
||||
if (ec != HDF_SUCCESS) {
|
||||
HDF_LOGE("%{public}s: call failed!", __func__);
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
if (!HdfSbufWriteUint32(reply, outSize)) {
|
||||
HDF_LOGE("%{public}s: write output size failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < outSize; i++) {
|
||||
for (uint32_t i = 0; i < outSize; i++) {
|
||||
if (!HdfSbufWriteInt8(reply, output[i])) {
|
||||
HDF_LOGE("%{public}s: write output failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
finished:
|
||||
FINISHED:
|
||||
if (input != NULL) {
|
||||
(void)OsalMemFree(input);
|
||||
}
|
||||
@@ -360,31 +360,31 @@ static int32_t SerStubArrayTypeTest(struct HdfDeviceIoClient *client, struct Hdf
|
||||
if (!HdfSbufReadInt8(data, (input + i))) {
|
||||
HDF_LOGE("%{public}s: read data size failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
ec = HdiSampleImplInstance()->ArrayTypeTest(client->device, input, inSize, &output, &outSize);
|
||||
if (ec != HDF_SUCCESS) {
|
||||
HDF_LOGE("%{public}s: call failed!", __func__);
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
if (!HdfSbufWriteUint32(reply, outSize)) {
|
||||
HDF_LOGE("%{public}s: write output size failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < outSize; i++) {
|
||||
for (uint32_t i = 0; i < outSize; i++) {
|
||||
if (!HdfSbufWriteInt8(reply, output[i])) {
|
||||
HDF_LOGE("%{public}s: write output failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
finished:
|
||||
FINISHED:
|
||||
if (input != NULL) {
|
||||
(void)OsalMemFree(input);
|
||||
}
|
||||
@@ -404,20 +404,20 @@ static int32_t SerStubStructTypeTest(struct HdfDeviceIoClient *client, struct Hd
|
||||
if (!HdfSbufReadBuffer(data, (const void **)&input, &dataSize)) {
|
||||
HDF_LOGE("%{public}s: read struct data failed!", __func__);
|
||||
ec = HDF_ERR_INVALID_PARAM;
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
ec = HdiSampleImplInstance()->StructTypeTest(client->device, input, &output);
|
||||
if (ec != HDF_SUCCESS) {
|
||||
HDF_LOGE("%{public}s: call StructTypeTest failed! error code is %{public}d", __func__, ec);
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
if (!HdfSbufWriteBuffer(reply, (const void *)&output, sizeof(output))) {
|
||||
HDF_LOGE("%{public}s: struct result write failed", __func__);
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
finished:
|
||||
FINISHED:
|
||||
return ec;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ static int32_t DevHostServiceProxyOpsDevice(
|
||||
struct DevHostServiceProxy *hostClnt = (struct DevHostServiceProxy *)inst;
|
||||
if (hostClnt->remote == NULL || data == NULL) {
|
||||
HDF_LOGE("Adding device failed, hostClnt->remote or data or reply is null");
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
DeviceAttributeSerialize(attribute, data);
|
||||
status = hostClnt->remote->dispatcher->Dispatch(hostClnt->remote, DEVHOST_SERVICE_ADD_DEVICE, data, NULL);
|
||||
finished:
|
||||
FINISHED:
|
||||
if (data != NULL) {
|
||||
HdfSbufRecycle(data);
|
||||
}
|
||||
@@ -58,13 +58,13 @@ static int32_t DevHostServiceProxyDelDevice(
|
||||
struct DevHostServiceProxy *hostClnt = (struct DevHostServiceProxy *)inst;
|
||||
if (hostClnt->remote == NULL || data == NULL) {
|
||||
HDF_LOGE("Del device failed, hostClnt->remote or data is null");
|
||||
goto finished;
|
||||
goto FINISHED;
|
||||
}
|
||||
|
||||
HdfSbufWriteUint32(data, devid);
|
||||
status = hostClnt->remote->dispatcher->Dispatch(hostClnt->remote, DEVHOST_SERVICE_DEL_DEVICE, data, NULL);
|
||||
|
||||
finished:
|
||||
FINISHED:
|
||||
if (data != NULL) {
|
||||
HdfSbufRecycle(data);
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#define HDF_LOG_TAG devsvc_manager_stub
|
||||
|
||||
static struct HdfDeviceObject *ObtainServiceObject(struct DevSvcManagerStub *stub,
|
||||
const char *name, struct HdfRemoteService *service)
|
||||
static struct HdfDeviceObject *ObtainServiceObject(
|
||||
struct DevSvcManagerStub *stub, const char *name, struct HdfRemoteService *service)
|
||||
{
|
||||
struct HdfDeviceObject *serviceObject = OsalMemCalloc(sizeof(struct HdfDeviceObject));
|
||||
if (serviceObject == NULL) {
|
||||
@@ -54,7 +54,7 @@ static void ReleaseServiceObject(struct DevSvcManagerStub *stub, struct HdfDevic
|
||||
HDF_LOGW("release service object has empty name, may broken object");
|
||||
return;
|
||||
}
|
||||
struct HdfRemoteService *serviceRemote = (struct HdfRemoteService *) serviceObject->service;
|
||||
struct HdfRemoteService *serviceRemote = (struct HdfRemoteService *)serviceObject->service;
|
||||
HdfRemoteServiceRemoveDeathRecipient(serviceRemote, &stub->recipient);
|
||||
HdfRemoteServiceRecycle((struct HdfRemoteService *)serviceObject->service);
|
||||
OsalMemFree(serviceObject->priv);
|
||||
@@ -227,8 +227,8 @@ static int32_t DevSvcManagerStubRegisterServListener(struct IDevSvcManager *supe
|
||||
return HDF_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
struct ServStatListenerHolder *listenerHolder
|
||||
= ServStatListenerHolderCreate((uintptr_t)listenerRemote, listenClass);
|
||||
struct ServStatListenerHolder *listenerHolder =
|
||||
ServStatListenerHolderCreate((uintptr_t)listenerRemote, listenClass);
|
||||
if (listenerHolder == NULL) {
|
||||
return HDF_ERR_MALLOC_FAIL;
|
||||
}
|
||||
@@ -305,8 +305,8 @@ int DevSvcManagerStubDispatch(struct HdfRemoteService *service, int code, struct
|
||||
|
||||
void DevSvcManagerOnServiceDied(struct HdfDeathRecipient *recipient, struct HdfRemoteService *remote)
|
||||
{
|
||||
struct DevSvcManagerStub *stub
|
||||
= HDF_SLIST_CONTAINER_OF(struct HdfDeathRecipient, recipient, struct DevSvcManagerStub, recipient);
|
||||
struct DevSvcManagerStub *stub =
|
||||
HDF_SLIST_CONTAINER_OF(struct HdfDeathRecipient, recipient, struct DevSvcManagerStub, recipient);
|
||||
if (stub == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ int DevSvcManagerStubStart(struct IDevSvcManager *svcmgr)
|
||||
|
||||
ServStatListenerHolderinit();
|
||||
|
||||
static struct HdfRemoteDispatcher dispatcher = { .Dispatch = DevSvcManagerStubDispatch };
|
||||
static struct HdfRemoteDispatcher dispatcher = {.Dispatch = DevSvcManagerStubDispatch};
|
||||
inst->remote = HdfRemoteServiceObtain((struct HdfObject *)inst, &dispatcher);
|
||||
if (inst->remote == NULL) {
|
||||
HDF_LOGE("failed to obtain device service manager remote service");
|
||||
|
||||
@@ -66,6 +66,7 @@ struct HdfDeviceInfo *DeviceAttributeDeserialize(struct HdfSBuf *sbuf)
|
||||
if (!HdfSbufReadUint32(sbuf, &attribute->deviceId) ||
|
||||
!HdfSbufReadUint16(sbuf, &attribute->policy)) {
|
||||
HDF_LOGE("invalid deviceId or policy");
|
||||
DeviceSerializedAttributeRelease(attribute);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user