forked from wolfSSL/wolfssl
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
|
||||
* 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;
|
||||
int ret, count = 0;;
|
||||
@@ -112,7 +112,7 @@ unsigned int CAAM_ADR_TO_PHYSICAL(void* in, int inSz)
|
||||
count++;
|
||||
} 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;
|
||||
}
|
||||
|
||||
void wc_caamWriteRegister(word32 reg, word32 value)
|
||||
|
||||
/* returns 0 on success */
|
||||
int wc_caamWriteRegister(word32 reg, word32 value)
|
||||
{
|
||||
if (caam == NULLIODevice) {
|
||||
WOLFSSL_MSG("Error CAAM IODevice not found! Bad password?");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (WriteIODeviceRegister(caam, reg, value) != Success) {
|
||||
WOLFSSL_MSG("Error writing to register\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -328,9 +328,12 @@ int SynchronousSendRequest(int type, unsigned int args[4], CAAM_BUFFER *buf,
|
||||
return -1;
|
||||
}
|
||||
|
||||
wc_LockMutex(&caamMutex);
|
||||
ret = devctlv(caamFd, cmd, inIdx, outIdx, in, out, NULL);
|
||||
wc_UnLockMutex(&caamMutex);
|
||||
ret = wc_LockMutex(&caamMutex);
|
||||
if (ret == 0) {
|
||||
ret = devctlv(caamFd, cmd, inIdx, outIdx, in, out, NULL);
|
||||
wc_UnLockMutex(&caamMutex);
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
if (ret == EFAULT) {
|
||||
WOLFSSL_MSG("bad address on one of the in/out buffers");
|
||||
|
Reference in New Issue
Block a user