PCIE framework code

Signed-off-by: liangxuewu <sucer_fater@163.com>
This commit is contained in:
liangxuewu
2021-12-28 11:44:46 +00:00
parent 9f403e320a
commit 20f439b198
2 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -52,15 +52,15 @@ static int32_t PcieCmdRead(struct PcieCntlr *cntlr, struct HdfSBuf *data, struct
ret = PcieCntlrRead(cntlr, pos, buf, len);
if (ret != HDF_SUCCESS) {
HDF_LOGE("PcieCntlrRead: error, ret is %d", ret);
goto EXIST;
goto EXIT;
}
if (!HdfSbufWriteBuffer(reply, buf, len)) {
HDF_LOGE("PcieCntlrRead: sbuf write buffer failed");
ret = HDF_ERR_IO;
goto EXIST;
goto EXIT;
}
ret = HDF_SUCCESS;
EXIST:
EXIT:
OsalMemFree(buf);
return ret;
}
+5 -5
View File
@@ -72,24 +72,24 @@ static int32_t PcieUserRead(DevHandle handle, uint32_t pos, uint8_t *data, uint3
if (buf == NULL) {
HDF_LOGE("PcieUserRead: failed to obtain buf");
ret = HDF_ERR_MALLOC_FAIL;
goto __EXIT;
goto EXIT;
}
if (!HdfSbufWriteUint32(buf, len)) {
HDF_LOGE("PcieUserRead: sbuf write uint32 failed");
ret = HDF_ERR_IO;
goto __EXIT;
goto EXIT;
}
if (!HdfSbufWriteUint32(buf, pos)) {
HDF_LOGE("PcieUserRead: sbuf write uint32 failed");
ret = HDF_ERR_IO;
goto __EXIT;
goto EXIT;
}
reply = HdfSBufObtainDefaultSize();
if (reply == NULL) {
HDF_LOGE("PcieUserRead: failed to obtain reply");
ret = HDF_ERR_MALLOC_FAIL;
goto __EXIT;
goto EXIT;
}
ret = service->dispatcher->Dispatch(&service->object, PCIE_CMD_READ, buf, reply);
@@ -99,7 +99,7 @@ static int32_t PcieUserRead(DevHandle handle, uint32_t pos, uint8_t *data, uint3
ret = PcieGetDataFromReply(reply, data, len);
}
__EXIT :
EXIT :
if (reply != NULL) {
HdfSBufRecycle(reply);
}