mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 12:44:45 +02:00
check ret of lock and adjust return type
This commit is contained in:
@@ -89,7 +89,7 @@ int CAAM_SET_BASEADDR()
|
|||||||
/* convert a virtual address to a physical address
|
/* convert a virtual address to a physical address
|
||||||
* returns the physical address on success
|
* returns the physical address on success
|
||||||
*/
|
*/
|
||||||
unsigned int CAAM_ADR_TO_PHYSICAL(void* in, int inSz)
|
CAAM_ADDRESS CAAM_ADR_TO_PHYSICAL(void* in, int inSz)
|
||||||
{
|
{
|
||||||
off64_t ofst = 0;
|
off64_t ofst = 0;
|
||||||
int ret, count = 0;;
|
int ret, count = 0;;
|
||||||
@@ -112,7 +112,7 @@ unsigned int CAAM_ADR_TO_PHYSICAL(void* in, int inSz)
|
|||||||
count++;
|
count++;
|
||||||
} while (ret != 0 && ret == -1 && count < 5);
|
} while (ret != 0 && ret == -1 && count < 5);
|
||||||
|
|
||||||
return (int)ofst;
|
return (CAAM_ADDRESS)ofst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -224,16 +224,19 @@ word32 wc_caamReadRegister(word32 reg)
|
|||||||
return (word32)out;
|
return (word32)out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wc_caamWriteRegister(word32 reg, word32 value)
|
|
||||||
|
/* returns 0 on success */
|
||||||
|
int wc_caamWriteRegister(word32 reg, word32 value)
|
||||||
{
|
{
|
||||||
if (caam == NULLIODevice) {
|
if (caam == NULLIODevice) {
|
||||||
WOLFSSL_MSG("Error CAAM IODevice not found! Bad password?");
|
WOLFSSL_MSG("Error CAAM IODevice not found! Bad password?");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WriteIODeviceRegister(caam, reg, value) != Success) {
|
if (WriteIODeviceRegister(caam, reg, value) != Success) {
|
||||||
WOLFSSL_MSG("Error writing to register\n");
|
WOLFSSL_MSG("Error writing to register\n");
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -328,9 +328,12 @@ int SynchronousSendRequest(int type, unsigned int args[4], CAAM_BUFFER *buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_LockMutex(&caamMutex);
|
ret = wc_LockMutex(&caamMutex);
|
||||||
ret = devctlv(caamFd, cmd, inIdx, outIdx, in, out, NULL);
|
if (ret == 0) {
|
||||||
wc_UnLockMutex(&caamMutex);
|
ret = devctlv(caamFd, cmd, inIdx, outIdx, in, out, NULL);
|
||||||
|
wc_UnLockMutex(&caamMutex);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (ret == EFAULT) {
|
if (ret == EFAULT) {
|
||||||
WOLFSSL_MSG("bad address on one of the in/out buffers");
|
WOLFSSL_MSG("bad address on one of the in/out buffers");
|
||||||
|
Reference in New Issue
Block a user