Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions hal/tpm_io_zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ int TPM2_IoCb_Zephyr_I2C(TPM2_CTX* ctx, int isRead, word32 addr,
{
int ret = 0;
byte* tempBuf = NULL;
(void)userCtx;

if (buf == NULL) {
printf("Buffer passed is NULL");
Expand All @@ -111,11 +112,6 @@ int TPM2_IoCb_Zephyr_I2C(TPM2_CTX* ctx, int isRead, word32 addr,
return -1;
}

if (userCtx == NULL) {
//printf("UserCtx Cannot be NULL\n");
}


/* Init Zephyr I2C Driver */
if (_is_initialized_i2c == 0) {
if (TPM2_I2C_Zephyr_Init() != 0) {
Expand All @@ -129,6 +125,7 @@ int TPM2_IoCb_Zephyr_I2C(TPM2_CTX* ctx, int isRead, word32 addr,
tempBuf = (byte*)XMALLOC(1, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (tempBuf == NULL) {
printf("Failed to allocate temp buffer\n");
return -1;
}

tempBuf[0] = (byte)(addr & 0xFF);
Expand All @@ -143,10 +140,10 @@ int TPM2_IoCb_Zephyr_I2C(TPM2_CTX* ctx, int isRead, word32 addr,
}
else {
// Write operation: Register address + Data

tempBuf = (byte*)XMALLOC(size + 1, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (tempBuf == NULL) {
printf("Failed to allocate temp buffer\n");
return -1;
}

tempBuf[0] = (byte)(addr & 0xFF);
Expand All @@ -167,8 +164,6 @@ int TPM2_IoCb_Zephyr_I2C(TPM2_CTX* ctx, int isRead, word32 addr,
}
}



(void)ctx;
return ret;
}
Expand Down